1818 pull_request :
1919 types : [closed]
2020 branches : [main]
21+ push :
22+ branches :
23+ - dist
24+
2125jobs :
2226 release :
2327 runs-on : ubuntu-latest
@@ -33,28 +37,34 @@ jobs:
3337 with :
3438 path : ~/.gitconfig
3539 key : gitconfig-${{ github.run_id }}
40+
3641 - name : Checkout code
3742 uses : actions/checkout@v3
3843 with :
3944 token : ${{ secrets.GITHUB_TOKEN }}
45+
4046 - name : Clear Git config cache
4147 run : |
4248 git config --global --unset-all user.name || true
4349 git config --global --unset-all user.email || true
50+
4451 - name : Set Git Identity
4552 run : |
4653 git config --global user.name 'googlemaps-bot'
4754 git config --global user.email '[email protected] ' 55+
4856 - uses : actions/cache@v3
4957 with :
5058 path : ~/.npm
5159 key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
5260 restore-keys : |
5361 ${{ runner.os }}-node
5462 mode: 'max'
63+
5564 - uses : actions/setup-node@v3
5665 with :
5766 node-version : ' 22.x'
67+
5868 - run : npm i
5969 - run : npm run build-prod
6070
6777
6878 - name : Deploy to Firebase Hosting
6979 run : firebase deploy --only hosting
80+
81+ - name : Checkout dist branch
82+ run : |
83+ git fetch origin
84+ git branch -D dist || true
85+ git checkout -b dist
86+
87+ - name : Add and commit build output
88+ run : |
89+ git add .
90+ git commit -m "Automated build output"
91+
92+ - name : Push to dist branch
93+ run : git push origin dist --force
94+
95+ approve-and-merge :
96+ runs-on : ubuntu-latest
97+ if : ${{ github.ref == 'refs/heads/dist' }}
98+ steps :
99+ - name : Checkout code
100+ uses : actions/checkout@v3
101+
102+ - name : Create Pull Request
103+ id : cpr
104+ run : |
105+ 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
106+
107+ - name : Approve PR
108+ run : gh pr review --approve ${{ steps.cpr.outputs.pull_request_url }}
109+
110+ - name : Merge PR
111+ run : gh pr merge --auto --squash --delete-branch ${{ steps.cpr.outputs.pull_request_url }}
0 commit comments