Skip to content

Commit

Permalink
feat: don't deploy on PRs, change PR docker image naming scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakShearman committed Nov 4, 2024
1 parent c5bd4b6 commit 54415ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ jobs:
run: |
tag_prefix="ghcr.io/emortalmc/${{ matrix.service }}"
tags=""
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
short_sha=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7)
tags="$tag_prefix:pr-${{ github.event.number }}-$short_sha"
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
tags="$tag_prefix:${{ github.sha }},$tag_prefix:latest"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
tags="$tag_prefix:pr-${{ github.event.number }},$tag_prefix:${{github.event.pull_request.head.sha}}"
fi
echo "DOCKER_TAGS=$tags" >> "$GITHUB_ENV"
Expand All @@ -90,6 +90,7 @@ jobs:
deploy:
needs: [build-and-publish, detect-services]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' # Only run on main branch, non-PR pushes
env:
SERVICES: ${{ needs.detect-services.outputs.services }}
steps:
Expand Down

0 comments on commit 54415ca

Please sign in to comment.