Skip to content

Commit 00c40d8

Browse files
committed
feat: Adds post-build hook.
1 parent 6d5aceb commit 00c40d8

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

.github/workflows/dist-pr.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: dist-pr
2+
3+
on:
4+
push:
5+
branches:
6+
- dist # Trigger the workflow on pushes to the dist branch
7+
8+
jobs:
9+
approve-and-merge:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'github-actions[bot]' }}
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Create Pull Request
17+
id: cpr
18+
run: |
19+
echo "pull_request_url=$(gh pr create --title "chore: automated output update (dist)" --body "This PR contains updated build output from the dist branch." --base main --head dist)" >> $GITHUB_OUTPUT
20+
21+
- name: Approve PR
22+
run: gh pr review --approve ${{ steps.cpr.outputs.pull_request_url }}
23+
24+
- name: Merge PR
25+
run: gh pr merge --auto --squash --delete-branch ${{ steps.cpr.outputs.pull_request_url }}

.github/workflows/release.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
## Runs the release-please action for all new pushes to the main branch.
16-
## This updates the CHANGELOG.md, and uploads the contents of /dist to
17-
## the Cloud bucket. It does NOT release to Node, but it provides
18-
## handy version incrementing which is useful for us.
19-
2015
name: Release
2116

2217
on:
@@ -44,7 +39,7 @@ jobs:
4439
with:
4540
node-version: '22.x'
4641
- run: npm i
47-
- run: npm run build-all
42+
- run: npm run build-prod
4843

4944
- uses: google-github-actions/auth@v1
5045
with:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "Samples for the Google Maps JavaScript API.",
55
"scripts": {
66
"build-all": "npm run generate-index && npm run clean && npm run build --workspaces",
7+
"build-prod": "npm run generate-index && npm run clean && npm run build --workspaces && ./.git/hooks/post-build",
78
"clean": "bash samples/clean.sh",
89
"generate-index": "bash samples/generate-index.sh"
910
},

post-build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Checkout the dist branch
4+
git checkout dist || git checkout -b dist
5+
6+
# Add and commit the changes to the dist folder
7+
git add dist
8+
git commit -m "Update dist folder"
9+
10+
# Push the changes to the dist branch
11+
git push origin dist

0 commit comments

Comments
 (0)