name: Publish
on:
push:
branches:
- "main"
- "development"
jobs:
docker:
runs-on: ubuntu-22.04
container: fascinated/docker-images:node-latest
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v7
- name: checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Repo
uses: docker/login-action@v2
with:
username: ${{ secrets.REPO_USERNAME }}
password: ${{ secrets.REPO_TOKEN }}
- name: Restore Docker Build Cache
uses: actions/cache@v3
id: build-cache
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx
- name: Build and Push (Latest)
uses: docker/build-push-action@v5
if: steps.branch-name.outputs.current_branch == 'main'
push: true
context: .
tags: fascinated/beatsaber-overlay:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Build and Push (Other Branches)
if: steps.branch-name.outputs.current_branch != 'main'
tags: fascinated/beatsaber-overlay:${{ steps.branch-name.outputs.current_branch }}