|
21 | 21 | SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
|
22 | 22 |
|
23 | 23 | jobs:
|
24 |
| - docker-build: |
25 |
| - name: Build & publish Docker images |
| 24 | + prepare-docker: |
| 25 | + name: Prepare docker tag |
26 | 26 | runs-on: ubuntu-latest
|
27 | 27 | permissions:
|
28 | 28 | contents: write
|
29 |
| - packages: write |
30 |
| - strategy: |
31 |
| - matrix: |
32 |
| - target: |
33 |
| - - name: builder |
34 |
| - image: action-release-builder-image |
35 |
| - - name: app |
36 |
| - image: action-release-image |
| 29 | + outputs: |
| 30 | + docker_tag: ${{ steps.docker_tag.outputs.docker_tag }} |
37 | 31 | steps:
|
38 | 32 | - name: Checkout repo
|
39 | 33 | uses: actions/checkout@v4
|
40 |
| - with: |
41 |
| - fetch-depth: 0 |
42 | 34 |
|
43 |
| - - name: Set git user to getsentry-bot |
44 |
| - if: github.ref == 'refs/heads/master' |
45 |
| - run: | |
46 |
| - echo "GIT_COMMITTER_NAME=getsentry-bot" >> $GITHUB_ENV; |
47 |
| - echo "GIT_AUTHOR_NAME=getsentry-bot" >> $GITHUB_ENV; |
48 |
| - echo "[email protected]" >> $GITHUB_ENV; |
49 |
| -
|
50 |
| - - name: Evaluate docker tag |
51 |
| - env: |
52 |
| - GITHUB_TOKEN: ${{ secrets.GH_SENTRY_BOT_PAT }} |
| 35 | + - name: Get docker tag |
| 36 | + id: docker_tag |
53 | 37 | run: |
|
54 | 38 | if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
|
55 |
| - echo "DOCKER_TAG=master" >> $GITHUB_ENV |
| 39 | + echo "docker_tag=master" >> $GITHUB_OUTPUT |
56 | 40 | yarn set-docker-tag master
|
57 |
| -
|
58 |
| - if ! git diff --quiet action.yml; then |
59 |
| - git add action.yml |
60 |
| - SKIP=lint,format,set-docker-tag-from-branch git commit -m "chore: Set docker tag for master [skip-ci]" |
61 |
| - git push |
62 |
| - fi |
63 | 41 | else
|
64 | 42 | TAG=$(yq '... | select(has("uses") and .uses | test("docker://ghcr.io/getsentry/action-release-image:.*")) | .uses' action.yml | awk -F':' '{print $3}')
|
65 |
| - echo "DOCKER_TAG=$TAG" >> $GITHUB_ENV |
| 43 | + echo "docker_tag=$TAG" >> $GITHUB_OUTPUT |
66 | 44 |
|
67 | 45 | if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
68 | 46 | if [[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
69 |
| - echo "Error: DOCKER_TAG $TAG matching format MAJOR.MINOR.PATCH is not allowed inside pull requests." |
| 47 | + echo "Error: docker_tag $TAG matching format MAJOR.MINOR.PATCH is not allowed inside pull requests." |
70 | 48 | echo "Please rename the docker tag in action.yml and try again."
|
71 | 49 | exit 1
|
72 | 50 | fi
|
73 | 51 | fi
|
74 | 52 | fi
|
75 | 53 |
|
| 54 | + - name: Get auth token |
| 55 | + id: token |
| 56 | + uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 |
| 57 | + if: github.ref == 'refs/heads/master' |
| 58 | + with: |
| 59 | + app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }} |
| 60 | + private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }} |
| 61 | + |
| 62 | + - name: Commit changes |
| 63 | + |
| 64 | + if: github.ref == 'refs/heads/master' |
| 65 | + with: |
| 66 | + github-token: ${{ steps.token.outputs.token }} |
| 67 | + message: "chore: Set docker tag for master [skip-ci]" |
| 68 | + |
| 69 | + docker-build: |
| 70 | + name: Build & publish Docker images |
| 71 | + needs: prepare-docker |
| 72 | + runs-on: ubuntu-latest |
| 73 | + permissions: |
| 74 | + packages: write |
| 75 | + strategy: |
| 76 | + matrix: |
| 77 | + target: |
| 78 | + - name: builder |
| 79 | + image: action-release-builder-image |
| 80 | + - name: app |
| 81 | + image: action-release-image |
| 82 | + steps: |
| 83 | + - name: Checkout repo |
| 84 | + uses: actions/checkout@v4 |
| 85 | + with: |
| 86 | + fetch-depth: 0 |
| 87 | + |
76 | 88 | - name: Set up QEMU
|
77 | 89 | uses: docker/setup-qemu-action@v3
|
78 | 90 |
|
|
98 | 110 | with:
|
99 | 111 | platforms: linux/amd64,linux/arm64
|
100 | 112 | push: true
|
101 |
| - tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.target.image }}:${{ env.DOCKER_TAG }} |
| 113 | + tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.target.image }}:${{ needs.prepare-docker.outputs.docker_tag }} |
102 | 114 | cache-from: ghcr.io/${{ github.repository_owner }}/${{ matrix.target.image }}:master
|
103 | 115 | target: ${{ matrix.target.name }}
|
104 | 116 | build-args: BUILDKIT_INLINE_CACHE=1
|
|
0 commit comments