-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathon-merge-qvac-lib-decoder-audio.yml
More file actions
208 lines (193 loc) · 6.79 KB
/
Copy pathon-merge-qvac-lib-decoder-audio.yml
File metadata and controls
208 lines (193 loc) · 6.79 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: On Merge Trigger (Decoder-audio)
on:
push:
branches:
- main
- release-*
- feature-*
- tmp-*
paths:
- "packages/qvac-lib-decoder-audio/**"
- ".github/workflows/*decoder-audio*.yml"
workflow_dispatch:
inputs:
tag:
description: "Tag to publish with"
required: false
default: "dev"
type: choice
options:
- latest
- dev
permissions:
contents: read
pull-requests: read
packages: read
id-token: write
jobs:
publish-logic:
runs-on: ubuntu-latest
outputs:
publish_main: ${{ steps.logic.outputs.publish_main }}
publish_release: ${{ steps.logic.outputs.publish_release }}
publish_feature: ${{ steps.logic.outputs.publish_feature }}
publish_tmp: ${{ steps.logic.outputs.publish_tmp }}
gpr_tag: ${{ steps.logic.outputs.gpr_tag }}
steps:
- id: logic
shell: bash
env:
INPUT_TAG: ${{ inputs.tag }}
run: |
set -euo pipefail
ref_name="${GITHUB_REF_NAME}"
event_name="${GITHUB_EVENT_NAME}"
input_tag="${INPUT_TAG}"
publish_main="false"
publish_release="false"
publish_feature="false"
publish_tmp="false"
if [ "$event_name" = "push" ] || [ "$event_name" = "workflow_dispatch" ]; then
if [ "$ref_name" = "main" ]; then
publish_main="true"
elif [[ "$ref_name" == release-* ]]; then
publish_release="true"
elif [[ "$ref_name" == feature-* ]]; then
publish_feature="true"
elif [[ "$ref_name" == tmp-* ]]; then
publish_tmp="true"
fi
fi
gpr_tag="$input_tag"
if [ -z "$gpr_tag" ]; then
if [ "$ref_name" = "main" ]; then
gpr_tag="dev"
elif [[ "$ref_name" == feature-* ]]; then
gpr_tag="feature"
elif [[ "$ref_name" == tmp-* ]]; then
gpr_tag="temp"
else
gpr_tag="dev"
fi
fi
echo "publish_main=$publish_main" >> "$GITHUB_OUTPUT"
echo "publish_release=$publish_release" >> "$GITHUB_OUTPUT"
echo "publish_feature=$publish_feature" >> "$GITHUB_OUTPUT"
echo "publish_tmp=$publish_tmp" >> "$GITHUB_OUTPUT"
echo "gpr_tag=$gpr_tag" >> "$GITHUB_OUTPUT"
release-merge-guard:
name: Release Merge Guard
if: >-
(github.event_name == 'push' || github.event_name == 'workflow_dispatch') &&
startsWith(github.ref_name, 'release-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
with:
fetch-depth: 0
- uses: ./.github/actions/release-merge-guard
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
base-ref: ${{ github.ref_name }}
base-sha: ${{ github.event.before }}
head-sha: ${{ github.sha }}
package-slug: qvac-lib-decoder-audio
package-json-path: packages/qvac-lib-decoder-audio/package.json
changelog-path: packages/qvac-lib-decoder-audio/CHANGELOG.md
run-integration-tests:
needs: publish-logic
if: |
needs.publish-logic.outputs.publish_main == 'true' ||
needs.publish-logic.outputs.publish_release == 'true' ||
needs.publish-logic.outputs.publish_feature == 'true' ||
needs.publish-logic.outputs.publish_tmp == 'true'
uses: ./.github/workflows/integration-test-qvac-lib-decoder-audio.yml
secrets: inherit
with:
repository: ${{ github.repository }}
ref: ${{ github.sha }}
workdir: "packages/qvac-lib-decoder-audio"
mobile-integration-tests:
needs: publish-logic
permissions:
contents: read
packages: read
pull-requests: write
id-token: write
if: |
needs.publish-logic.outputs.publish_main == 'true' ||
needs.publish-logic.outputs.publish_release == 'true' ||
needs.publish-logic.outputs.publish_feature == 'true' ||
needs.publish-logic.outputs.publish_tmp == 'true'
uses: ./.github/workflows/integration-mobile-test-qvac-lib-decoder-audio.yml
secrets: inherit
with:
repository: ${{ github.repository }}
ref: ${{ github.sha }}
workdir: "packages/qvac-lib-decoder-audio"
publish-gpr:
needs: [publish-logic, run-integration-tests, mobile-integration-tests]
if: |
needs.publish-logic.outputs.publish_main == 'true' ||
needs.publish-logic.outputs.publish_feature == 'true' ||
needs.publish-logic.outputs.publish_tmp == 'true'
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
with:
fetch-depth: 0
- name: Publish to GitHub Packages
uses: tetherto/qvac-devops/.github/actions/publish-library-to-gpr@v1.1.8
with:
secret-token: ${{ secrets.GITHUB_TOKEN }}
pat-token: ${{ secrets.PAT_TOKEN }}
npm-token: ${{ secrets.NPM_TOKEN }}
tag: ${{ needs.publish-logic.outputs.gpr_tag }}
workdir: "packages/qvac-lib-decoder-audio"
name-suffix: "-mono"
publish-release-npm:
needs: [publish-logic, release-merge-guard, run-integration-tests, mobile-integration-tests]
if: |
!cancelled() &&
needs.publish-logic.outputs.publish_release == 'true' &&
needs.release-merge-guard.result == 'success'
runs-on: ubuntu-latest
environment: release
outputs:
published_version: ${{ steps.publish.outputs.npm_published_version }}
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
- name: Publish to NPM Package Registry
id: publish
uses: tetherto/qvac-devops/.github/actions/publish-library-to-npm-oidc@v1.1.8
with:
secret-token: ${{ secrets.NPM_TOKEN }}
tag: "latest"
repo_name: "decoder-audio"
git-token: ${{ secrets.GITHUB_TOKEN }}
workdir: "packages/qvac-lib-decoder-audio"
publish-release:
needs: [publish-release-npm]
if: |
!cancelled() &&
needs.publish-release-npm.result == 'success' &&
needs.publish-release-npm.outputs.published_version != ''
permissions:
contents: write
uses: ./.github/workflows/create-github-release.yml
with:
repo_name: "decoder-audio"
release_name: "QVAC Decoder Audio Lib"
published_version: ${{ needs.publish-release-npm.outputs.published_version }}
prev_sha: ${{ github.event.before }}
workdir: "packages/qvac-lib-decoder-audio"