Skip to content

Commit e23d8a9

Browse files
committed
fix: modify the production workflow
1 parent e3bd23c commit e23d8a9

File tree

3 files changed

+9
-76
lines changed

3 files changed

+9
-76
lines changed

.github/prerelease-config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"packages": {
77
".": {
88
"type": "generic",
9-
"extra-files": [".platform/terraform/environments/staging/main.tf"]
9+
"extra-files": [
10+
".platform/terraform/environments/staging/main.tf",
11+
".github/prerelease-manifest.json"
12+
]
1013
}
1114
}
1215
}

.github/release-config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"packages": {
44
".": {
55
"type": "generic",
6-
"extra-files": [".platform/terraform/environments/production/main.tf"]
6+
"extra-files": [
7+
".platform/terraform/environments/production/main.tf",
8+
".github/prerelease-manifest.json"
9+
]
710
}
811
}
912
}

.github/workflows/release.yaml

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request:
8-
types: [opened, synchronize, reopened, closed]
9-
branches:
10-
- main
117

128
concurrency:
139
group: release
@@ -18,53 +14,13 @@ jobs:
1814
outputs:
1915
releases_created: ${{ steps.release.outputs.releases_created }}
2016
tag_name: ${{ steps.release.outputs.tag_name }}
21-
pr: ${{ steps.release.outputs.pr }}
2217
steps:
2318
- id: release
2419
name: Run release-please
2520
uses: googleapis/release-please-action@v4
2621
with:
2722
config-file: ".github/prerelease-config.json"
2823
manifest-file: ".github/prerelease-manifest.json"
29-
fork: false
30-
token: ${{ secrets.GITHUB_TOKEN }}
31-
32-
update-manifest-in-pr:
33-
runs-on: ubuntu-latest
34-
needs: release-please
35-
# Only run when a release PR is opened or updated, not when it's merged
36-
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref == 'release-please--branches--main' && github.event.pull_request.closed == false }}
37-
steps:
38-
- name: Checkout PR branch
39-
uses: actions/checkout@v4
40-
with:
41-
ref: ${{ github.event.pull_request.head.ref }}
42-
token: ${{ secrets.GITHUB_TOKEN }}
43-
44-
- name: Extract new version
45-
id: extract-version
46-
run: |
47-
PR_TITLE="${{ github.event.pull_request.title }}"
48-
if [[ $PR_TITLE =~ chore\(main\):[[:space:]]release[[:space:]]([0-9]+\.[0-9]+\.[0-9]+) ]]; then
49-
echo "version=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
50-
else
51-
echo "version=" >> $GITHUB_OUTPUT
52-
fi
53-
54-
- name: Update prerelease manifest with new version
55-
if: ${{ steps.extract-version.outputs.version != '' }}
56-
env:
57-
MANIFEST_PATH: .github/prerelease-manifest.json
58-
VERSION: ${{ steps.extract-version.outputs.version }}
59-
run: |
60-
jq --arg tag "$VERSION" '.["."] = $tag' $MANIFEST_PATH > temp.json \
61-
&& mv temp.json $MANIFEST_PATH
62-
63-
git config user.name "github-actions[bot]"
64-
git config user.email "github-actions[bot]@users.noreply.github.com"
65-
git add $MANIFEST_PATH
66-
git commit -m "chore: update prerelease manifest with version $VERSION"
67-
git push
6824

6925
deploy-test:
7026
name: Deploy to Test
@@ -116,35 +72,6 @@ jobs:
11672
11773
- name: Deploy
11874
run: echo "Deploying to production!"
119-
120-
sync-after-release:
121-
name: Sync Release Manifest
122-
runs-on: ubuntu-latest
123-
# Only run when a release is created and PR is merged (push to main)
124-
if: ${{ github.event_name == 'push' && needs.release-please.outputs.releases_created == 'true' }}
125-
needs: release-please
126-
steps:
127-
- name: Checkout main branch
128-
uses: actions/checkout@v4
129-
with:
130-
token: ${{ secrets.RELEASE_TOKEN }} # Use a token with repo scope
131-
132-
- name: Update prerelease manifest
133-
env:
134-
MANIFEST_PATH: .github/prerelease-manifest.json
135-
RELEASE_TAG: ${{ needs.release-please.outputs.tag_name }}
136-
run: |
137-
# Remove the 'v' prefix if present
138-
VERSION="${RELEASE_TAG//v/}"
139-
140-
jq --arg tag "$VERSION" '.["."] = $tag' $MANIFEST_PATH > temp.json \
141-
&& mv temp.json $MANIFEST_PATH
142-
143-
git config user.name "github-actions[bot]"
144-
git config user.email "github-actions[bot]@users.noreply.github.com"
145-
git add $MANIFEST_PATH
146-
git commit -m "chore: sync prerelease manifest with version $VERSION"
147-
git push
14875

14976
publish:
15077
name: Publish images
@@ -164,4 +91,4 @@ jobs:
16491
run: echo "Building for '${{ matrix.arch }}' ..."
16592

16693
- name: Publish
167-
run: echo "Publishing for '${{ matrix.arch }}' ..."
94+
run: echo "Publishing for '${{ matrix.arch }}' ..."

0 commit comments

Comments
 (0)