Skip to content

Commit

Permalink
try using bash to check default branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Erisa committed Oct 1, 2024
1 parent fe885bd commit 936b67f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set default branch variable
run : |
if [[ $GITHUB_REF_NAME == 'main' ]]; then
echo "IS_MAIN_BRANCH=true" >> "$GITHUB_ENV"
else
echo "IS_MAIN_BRANCH=false" >> "$GITHUB_ENV"
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -61,7 +69,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=ubicloud-${{ matrix.runner }}
cache-to: type=gha,mode=max,scope=ubicloud-${{ matrix.runner }}
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest={{is_default_branch}},name-canonical={{is_default_branch}},push={{is_default_branch}}
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=${{env.IS_MAIN_BRANCH}},name-canonical=${{env.IS_MAIN_BRANCH}},push=${{env.IS_MAIN_BRANCH}}
provenance: false

- name: Export digest
Expand Down

0 comments on commit 936b67f

Please sign in to comment.