Skip to content

Commit

Permalink
Extended Docker build and push to 'release' branch
Browse files Browse the repository at this point in the history
The Docker build and push workflow has been extended to include the 'release' branch. Now, in addition to the 'main' branch, any changes pushed to the 'release' branch will trigger this workflow. Also, a new environment variable BRANCH_NAME has been added which holds the name of the current Git branch. The login and build-push actions for ghcr are now conditional on whether BRANCH_NAME is set to 'release'. Similar changes have also been made in the Release workflow where it's now triggered by pushes to the 'release' branch instead of 'main'.
  • Loading branch information
leokwsw committed Mar 29, 2024
1 parent 57eebe4 commit 62700dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/docker-push.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: Docker build and push

on:
push:
branches:
- main
push:
branches:
- main
- release

env:
PLATFORMS: ${{ vars.PLATFORMS || 'linux/amd64,linux/arm64' }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
docker:
Expand Down Expand Up @@ -57,13 +59,15 @@ jobs:

- name: Log into ghcr
uses: docker/login-action@v2
if: ${{ env.BRANCH_NAME == 'release' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GT_TOKEN }}

- name: Build and push to ghcr
uses: docker/build-push-action@v4
if: ${{ env.BRANCH_NAME == 'release' }}
with:
context: .
platforms: ${{ env.PLATFORMS }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: Release
on:
push:
branches:
- 'main'
- 'release'

env:
PLATFORMS: ${{ vars.PLATFORMS || 'linux/amd64,linux/arm64' }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
release:
Expand Down

0 comments on commit 62700dd

Please sign in to comment.