-
Notifications
You must be signed in to change notification settings - Fork 2
/
update-dev.yml
78 lines (74 loc) · 2.41 KB
/
update-dev.yml
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
76
77
78
name: Update Dev Dependencies
on:
workflow_dispatch:
repository_dispatch:
types: [new_module_release]
schedule:
# 04:15 UTC on Mondays
- cron: "15 4 * * 1"
pull_request_target:
types:
- closed
branches:
- main
permissions:
contents: write
jobs:
trigger-next-env:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'updates-dev')
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
event-type: dev_updates_merged
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "branch": "${{ github.head_ref }}" }'
patcher-report:
if: github.event_name == 'repository_dispatch' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
spec: ${{ steps.run-report.outputs.spec }}
steps:
- uses: actions/checkout@v4
- uses: gruntwork-io/patcher-action@v2
id: run-report
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
patcher_command: report
working_dir: ./
spec_file: spec.json
include_dirs: "{*dev*}/**"
- uses: actions/upload-artifact@v4
with:
name: spec-file
path: spec.json
update-env:
needs: [patcher-report]
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 2
matrix:
include: ${{ fromJson(needs.patcher-report.outputs.spec).Dependencies }}
steps:
- uses: actions/checkout@v4
- name: Create trigger source message
if: github.event_name == 'repository_dispatch'
id: trigger_event
run: |
echo "source=Triggered by a new release in \`dogfood-infrastructure-modules\`" >> "$GITHUB_OUTPUT"
- name: Load spec file
uses: actions/download-artifact@v4
with:
name: spec-file
- uses: gruntwork-io/patcher-action@v2
id: run-update
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
patcher_command: update
working_dir: ./
spec_file: spec.json
pull_request_title: "[Patcher] [dev] Update ${{ matrix.ID }}"
pull_request_branch: "patcher-dev-updates-${{ matrix.ID }}"
dependency: ${{ matrix.ID }}