-
Notifications
You must be signed in to change notification settings - Fork 11
111 lines (103 loc) · 3.32 KB
/
post-promote-tasks.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Post promote tasks
on:
pull_request:
types:
- closed
branches:
- 'main'
paths:
- 'configs/versions.json'
workflow_dispatch:
inputs:
pull_number:
type: number
jobs:
setup:
if: github.event.pull_request.merged || github.event.inputs.pull_number
runs-on: ubuntu-latest
outputs:
npm: ${{ steps.get-tasks.outputs.npm }}
calendar: ${{ steps.get-tasks.outputs.calendar }}
tagger: ${{ steps.get-tasks.outputs.tagger }}
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Get tasks
id: get-tasks
run: npx tsx ./scripts/post-promote-tasks-job.ts --pull_number="${{ github.event.pull_request.number }}" --override_pull_number="${{ github.event.inputs.pull_number }}"
release-calendar:
needs: setup
if: needs.setup.outputs.calendar
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.setup.outputs.calendar) }}
fail-fast: false
steps:
- name: Create event on release calendar
uses: fjogeleit/http-request-action@v1
with:
url: '${{ secrets.CALENDAR_URI }}'
customHeaders: '{"Authorization": "Basic ${{ secrets.CALENDAR_TOKEN }}"}'
data: >
{
"release":
{
"name": "${{ matrix.includes.amp-version }}"
},
"promotion":
{
"releaseName": "${{ matrix.includes.amp-version }}",
"time": "${{ matrix.includes.time }}",
"channel": "${{ matrix.includes.channel }}"
}
}
release-tagger:
needs: setup
if: needs.setup.outputs.tagger
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.setup.outputs.tagger) }}
fail-fast: false
steps:
- name: Trigger release tagger workflow on amphtml
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.github.com/repos/ampproject/amphtml/actions/workflows/release-tagger.yml/dispatches'
bearerToken: ${{ secrets.ACCESS_TOKEN }}
data: >
{
"ref": "main",
"inputs":
{
"action": "${{ matrix.includes.action }}",
"head": "${{ matrix.includes.head }}",
"base": "${{ matrix.includes.base }}",
"channel": "${{ matrix.includes.channel }}",
"sha": "${{ matrix.includes.sha }}"
}
}
create-issue-on-error:
if: failure()
needs: [setup, release-calendar, release-tagger]
permissions:
contents: read
issues: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Create issue on error
uses: JasonEtco/create-an-issue@v2
with:
filename: .github/create_issue_on_error.md
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
WORKFLOW_NAME: ${{ github.workflow }}
MENTION: '@ampproject/wg-infra'
REPO_SLUG: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}