Repository navigation
194 lines (186 loc) · 7.2 KB
/
Copy pathomnia-production.yml
File metadata and controls
194 lines (186 loc) · 7.2 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
name: OMNIA — Nightly Production Branch
on:
schedule:
- cron: '17 2 * * *'
timezone: America/Los_Angeles
# GitHub requires repository write access for manual dispatch. The candidate
# job below also admits only this fork's dev ref and exact successful push CI.
workflow_dispatch:
permissions:
contents: read
concurrency:
group: omnia-production
cancel-in-progress: false
jobs:
candidate:
name: Select newest dev source with successful push CI
# Bound to the organization, so renaming the repository does not stop the nightly.
if: ${{ github.repository_owner == 'omnia-digital' && github.ref == 'refs/heads/dev' }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
actions: read
contents: read
outputs:
source_sha: ${{ steps.select.outputs.source_sha }}
ci_run_id: ${{ steps.select.outputs.ci_run_id }}
release_tag: ${{ steps.select.outputs.release_tag }}
build_needed: ${{ steps.select.outputs.build_needed }}
steps:
- name: Checkout trusted workflow control
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ github.repository }}
ref: ${{ github.sha }}
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22.x
- name: Select nightly source and decide whether it needs a build
id: select
env:
GH_TOKEN: ${{ github.token }}
TRIGGER_SHA: ${{ github.sha }}
run: node scripts/fork/select-nightly-candidate.mjs
verify_source_ci:
name: Verify exact source CI lanes and artifact
needs: [candidate]
# Skipping here also skips every job below: they all depend on this one.
if: needs.candidate.outputs.build_needed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
contents: read
steps:
- name: Checkout trusted workflow control
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ github.repository }}
ref: ${{ github.sha }}
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22.x
- name: Verify canonical push CI
env:
GH_TOKEN: ${{ github.token }}
SOURCE_SHA: ${{ needs.candidate.outputs.source_sha }}
CI_RUN_ID: ${{ needs.candidate.outputs.ci_run_id }}
run: |
set -euo pipefail
node scripts/pipeline/release/verify-existing-ci.mjs \
--repository "$GITHUB_REPOSITORY" \
--source-sha "$SOURCE_SHA" \
--source-branch dev \
--run-id "$CI_RUN_ID"
desktop_candidate:
name: Build certified native source (Apple Silicon on Cassian)
needs: [candidate, verify_source_ci]
# The reusable release owner declares write permission for its publishing
# phases. Every unsigned build job explicitly reduces this to contents:read.
permissions:
contents: write
actions: read
uses: ./.github/workflows/build-tauri.yml
with:
source_ref: ${{ needs.candidate.outputs.source_sha }}
environment: production
preparation_only: true
publish_release: false
cassian_build: true
release_message: Omnia nightly candidate ${{ needs.candidate.outputs.source_sha }}
promote:
name: Fast-forward production to certified dev SHA
needs: [candidate, verify_source_ci, desktop_candidate]
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout trusted workflow control
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ github.repository }}
ref: ${{ github.sha }}
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22.x
- name: Create fork GitHub App token
id: app_token
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547
with:
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: ${{ github.event.repository.name }}
permission-contents: write
permission-workflows: write
- name: Promote certified source through canonical branch owner
env:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
GH_REPO: ${{ github.repository }}
SOURCE_SHA: ${{ needs.candidate.outputs.source_sha }}
run: |
set -euo pipefail
node scripts/pipeline/run.mjs promote-branch \
--source dev \
--source-sha "$SOURCE_SHA" \
--target production \
--mode fast_forward \
--allow-reset false \
--confirm 'promote production from dev' \
--summary-file "$GITHUB_STEP_SUMMARY"
publish_release:
name: Publish nightly release
needs: [candidate, promote]
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
steps:
- name: Checkout trusted workflow control
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
repository: ${{ github.repository }}
ref: ${{ github.sha }}
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: 22.x
- name: Download installable app
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: omnia-happier-macos-arm64
# The pipeline refuses a dirty worktree, so assets stay outside the checkout.
path: ${{ runner.temp }}/omnia-nightly
- name: Publish immutable release through canonical pipeline owner
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ needs.candidate.outputs.release_tag }}
SOURCE_SHA: ${{ needs.candidate.outputs.source_sha }}
ASSETS_DIR: ${{ runner.temp }}/omnia-nightly
run: |
set -euo pipefail
# --replace-draft: a new run rebuilds the same SHA with different bytes, and
# a draft left by a failed publication would otherwise block that SHA forever.
node scripts/pipeline/run.mjs github-publish-release \
--tag "$RELEASE_TAG" \
--title "Omnia Happier nightly $RELEASE_TAG" \
--target-sha "$SOURCE_SHA" \
--prerelease false \
--rolling-tag false \
--generate-notes false \
--notes "Omnia Happier nightly build of $SOURCE_SHA." \
--assets "$ASSETS_DIR/omnia-happier-macos-arm64.tar.gz"$'\n'"$ASSETS_DIR/omnia-happier-macos-arm64.json" \
--clobber false \
--prune-assets false \
--latest true \
--replace-draft true \
--secrets-source env