Repository navigation
75 lines (67 loc) · 2.13 KB
/
Copy pathdeploy.yml
File metadata and controls
75 lines (67 loc) · 2.13 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Deploy
# Auto-deploys on every push to dev that touches the website image's
# inputs: the app source, its manifest/lockfile, deploy/Dockerfile, or the
# deploy workflows themselves. The steps live in build-migrate-deploy.yml,
# which deploy-prod.yml also runs, so dev exercises exactly the steps
# production runs. The deploy goes to the `dev` GitHub Environment, which
# targets the dev-fin-observatory GCP project.
on:
push:
branches: [dev]
workflow_dispatch: {}
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
website: ${{ steps.filter.outputs.website }}
environment: ${{ steps.env.outputs.environment }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
website:
- 'src/**'
- 'public/**'
- 'db/**'
- 'drizzle.config.ts'
- 'package.json'
- 'pnpm-lock.yaml'
- 'next.config.*'
- 'tsconfig.json'
- 'deploy/Dockerfile'
- '.github/workflows/deploy.yml'
- '.github/workflows/build-migrate-deploy.yml'
# dev is the only branch that deploys. REF_NAME is read through
# env: rather than interpolated into the script, so a branch name
# can't inject shell.
- id: env
env:
REF_NAME: ${{ github.ref_name }}
run: |
case "$REF_NAME" in
dev)
echo "environment=dev" >> "$GITHUB_OUTPUT"
;;
*)
echo "::error::No deploy environment is mapped for branch '$REF_NAME'."
exit 1
;;
esac
deploy:
needs: changes
if: needs.changes.outputs.website == 'true'
permissions:
contents: read
id-token: write
uses: ./.github/workflows/build-migrate-deploy.yml
# A called workflow sees no secrets, its environment's included, without this.
secrets: inherit
with:
environment: ${{ needs.changes.outputs.environment }}