Skip to content

Commit 31cedd2

Browse files
authored
fix: sync manifest when triggering production deployments (#38)
fix: sync manifest during production deployments
1 parent 40da907 commit 31cedd2

File tree

1 file changed

+26
-20
lines changed

1 file changed

+26
-20
lines changed

.github/workflows/release.yaml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,38 @@ jobs:
1414
outputs:
1515
releases_created: ${{ steps.release.outputs.releases_created }}
1616
tag_name: ${{ steps.release.outputs.tag_name }}
17+
pr: ${{ steps.release.outputs.pr }}
1718
steps:
1819
- id: release
1920
name: Run release-please
2021
uses: googleapis/release-please-action@v4
2122
with:
2223
config-file: ".github/prerelease-config.json"
2324
manifest-file: ".github/prerelease-manifest.json"
25+
fork: false
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Checkout PR branch
29+
if: ${{ steps.release.outputs.pr }}
30+
uses: actions/checkout@v4
31+
with:
32+
ref: release-please--branches--main
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Update prerelease manifest
36+
if: ${{ steps.release.outputs.pr }}
37+
env:
38+
MANIFEST_PATH: .github/prerelease-manifest.json
39+
RELEASE_TAG: ${{ steps.release.outputs.tag_name }}
40+
run: |
41+
jq --arg tag "${RELEASE_TAG//v/}" '.["."] = $tag' $MANIFEST_PATH > temp.json \
42+
&& mv temp.json $MANIFEST_PATH
43+
44+
git config user.name "github-actions[bot]"
45+
git config user.email "github-actions[bot]@users.noreply.github.com"
46+
git add $MANIFEST_PATH
47+
git commit -m "chore: sync release manifests"
48+
git push
2449
2550
deploy-test:
2651
name: Deploy to Test
@@ -73,25 +98,6 @@ jobs:
7398
- name: Deploy
7499
run: echo "Deploying to production!"
75100

76-
- name: Checkout
77-
uses: actions/checkout@v4
78-
79-
- name: Sync prerelease manifest
80-
env:
81-
MANIFEST_PATH: .github/prerelease-manifest.json
82-
RELEASE_TAG: ${{ needs.release-please.outputs.tag_name }}
83-
run: |
84-
jq --arg tag "${RELEASE_TAG//v/}" '.["."] = $tag' $MANIFEST_PATH > temp.json \
85-
&& mv temp.json $MANIFEST_PATH
86-
87-
- name: Commit change
88-
run: |
89-
git config user.name "github-actions[bot]"
90-
git config user.email "github-actions[bot]@users.noreply.github.com"
91-
git add . $MANIFEST_PATH
92-
git commit -m "chore: sync release manifests"
93-
git push
94-
95101
publish:
96102
name: Publish images
97103
runs-on: ubuntu-latest
@@ -110,4 +116,4 @@ jobs:
110116
run: echo "Building for '${{ matrix.arch }}' ..."
111117

112118
- name: Publish
113-
run: echo "Publishing for '${{ matrix.arch }}' ..."
119+
run: echo "Publishing for '${{ matrix.arch }}' ..."

0 commit comments

Comments
 (0)