Repository navigation
56 lines (52 loc) · 2.16 KB
/
Copy pathtrigger-deploy.yml
File metadata and controls
56 lines (52 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Hosting for this game lives in the WesleyArcadeSite repo (it owns the single
# Firebase Hosting site behind wesleyarcade.com). Pushing here therefore has to
# poke that repo to rebuild and redeploy the arcade.
#
# Requires two repo secrets, APP_ID and APP_PRIVATE_KEY, for the same GitHub App
# ReflectionsPhaser uses, with the app installed on WesleyArcadeSite. Until those
# exist the job skips with a notice rather than failing -- a red run on every
# push emails the owner about a condition they already know about, and trains
# them to ignore the one failure that eventually matters.
#
# Without the secrets, deploy by hand:
# gh workflow run "Deploy to Firebase Hosting" --repo TomWesley/WesleyArcadeSite
name: Trigger Wesley Arcade Deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
trigger-deploy:
runs-on: ubuntu-latest
steps:
# The secrets context is not available in a job-level `if`, so the check
# has to happen in a step and gate the rest.
- name: Check for deploy credentials
id: creds
env:
APP_ID: ${{ secrets.APP_ID }}
run: |
if [ -z "$APP_ID" ]; then
echo "configured=false" >> "$GITHUB_OUTPUT"
echo "::notice title=Deploy trigger skipped::APP_ID and APP_PRIVATE_KEY are not set on this repo, so the arcade was not notified. Deploy manually with: gh workflow run \"Deploy to Firebase Hosting\" --repo TomWesley/WesleyArcadeSite"
else
echo "configured=true" >> "$GITHUB_OUTPUT"
fi
- name: Generate GitHub App token
id: app-token
if: steps.creds.outputs.configured == 'true'
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: TomWesley
repositories: WesleyArcadeSite
- name: Trigger WesleyArcadeSite deployment
if: steps.creds.outputs.configured == 'true'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh api repos/TomWesley/WesleyArcadeSite/dispatches \
--method POST \
-f event_type=deploy