-
Notifications
You must be signed in to change notification settings - Fork 3
63 lines (55 loc) · 1.88 KB
/
Copy pathcicd-1-pull-request.yaml
File metadata and controls
63 lines (55 loc) · 1.88 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
name: "CI/CD: Pull Request"
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
concurrency:
group: pr-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write # needed to create pre-releases
id-token: write
security-events: write
attestations: write # needed by stage-3-build (attest-build-provenance)
jobs:
commit-stage:
uses: ./.github/workflows/stage-1-commit.yaml
secrets: inherit
test-stage:
needs: commit-stage
uses: ./.github/workflows/stage-2-test.yaml
secrets: inherit
deploy-stage:
name: Deploy stage
needs: [commit-stage, test-stage]
if: contains(github.event.pull_request.labels.*.name, 'deploy')
permissions:
id-token: write
uses: ./.github/workflows/stage-4-deploy.yaml
with:
environments: '["review"]'
commit_sha: ${{ github.event.pull_request.head.sha }}
branch_name: ${{ github.event.pull_request.head.ref }}
secrets: inherit
# Build and publish a pre-release when the 'deploy' label is present.
# Runs on every push while the label is active (synchronize re-triggers this).
build-for-deploy:
name: Build for deploy
needs: [commit-stage, test-stage]
if: contains(github.event.pull_request.labels.*.name, 'deploy')
uses: ./.github/workflows/stage-3-build.yaml
with:
pr_number: ${{ github.event.pull_request.number }}
secrets: inherit
deploy-app-stage:
name: Deploy app stage
needs: [build-for-deploy, deploy-stage]
if: contains(github.event.pull_request.labels.*.name, 'deploy')
permissions:
id-token: write
uses: ./.github/workflows/stage-4-deploy-app.yaml
with:
environments: '["review"]'
release_tag: pr-${{ github.event.pull_request.number }}
commit_sha: ${{ github.event.pull_request.head.sha }}
branch_name: ${{ github.event.pull_request.head.ref }}
secrets: inherit