forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (139 loc) · 5.4 KB
/
Copy pathupstream-release-sync.yml
File metadata and controls
146 lines (139 loc) · 5.4 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
name: Sync upstream stable release
on:
schedule:
- cron: "23 */6 * * *"
workflow_dispatch:
inputs:
latest_tag:
description: "Override the upstream tag (dry-run testing only)"
required: false
type: string
dry_run:
description: "Prepare and verify without publishing"
required: false
default: false
type: boolean
permissions: {}
concurrency:
group: upstream-release-sync
cancel-in-progress: false
jobs:
prepare:
name: Prepare immutable candidate
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
state: ${{ steps.prepare.outputs.state }}
latest_tag: ${{ steps.prepare.outputs.latest_tag }}
previous_tag: ${{ steps.prepare.outputs.previous_tag }}
dry_run: ${{ steps.prepare.outputs.dry_run }}
base_sha: ${{ steps.prepare.outputs.base_sha }}
head_sha: ${{ steps.prepare.outputs.head_sha }}
candidate_tree: ${{ steps.prepare.outputs.candidate_tree }}
bundle_sha256: ${{ steps.prepare.outputs.bundle_sha256 }}
metadata_sha256: ${{ steps.prepare.outputs.metadata_sha256 }}
artifact_name: ${{ steps.prepare.outputs.artifact_name }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Prepare candidate without executing it
id: prepare
env:
GH_TOKEN: ${{ github.token }}
LATEST_TAG_OVERRIDE: ${{ inputs.latest_tag }}
DRY_RUN: ${{ inputs.dry_run || false }}
run: .github/scripts/upstream-release-sync.sh prepare "$RUNNER_TEMP/release-sync-artifact"
- name: Upload immutable candidate bundle and metadata
id: upload
if: steps.prepare.outputs.state == 'update'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ steps.prepare.outputs.artifact_name }}
path: |
${{ runner.temp }}/release-sync-artifact/candidate.bundle
${{ runner.temp }}/release-sync-artifact/metadata.json
if-no-files-found: error
retention-days: 1
compression-level: 0
verify:
name: Verify exact candidate
needs: prepare
if: needs.prepare.outputs.state == 'update'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.sha }}
fetch-depth: 1
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version-file: package.json
- name: Download immutable candidate artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ needs.prepare.outputs.artifact_name }}
path: ${{ runner.temp }}/release-sync-artifact
- name: Verify tests, types, formatting, build, and integrity
env:
EXPECTED_BUNDLE_SHA256: ${{ needs.prepare.outputs.bundle_sha256 }}
EXPECTED_METADATA_SHA256: ${{ needs.prepare.outputs.metadata_sha256 }}
run: .github/scripts/upstream-release-sync.sh verify "$RUNNER_TEMP/release-sync-artifact"
publish:
name: Atomically promote verified candidate
needs: [prepare, verify]
if: needs.prepare.outputs.state == 'update' && needs.prepare.outputs.dry_run != 'true'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
statuses: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.sha }}
fetch-depth: 1
persist-credentials: false
- name: Download verified immutable candidate artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ needs.prepare.outputs.artifact_name }}
path: ${{ runner.temp }}/release-sync-artifact
- name: Post status and atomically promote exact head
env:
GH_TOKEN: ${{ github.token }}
EXPECTED_BUNDLE_SHA256: ${{ needs.prepare.outputs.bundle_sha256 }}
EXPECTED_METADATA_SHA256: ${{ needs.prepare.outputs.metadata_sha256 }}
run: .github/scripts/upstream-release-sync.sh publish "$RUNNER_TEMP/release-sync-artifact"
notify:
name: Report automation result
needs: [prepare, verify, publish]
if: always()
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
issues: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.sha }}
fetch-depth: 1
persist-credentials: false
sparse-checkout: .github/scripts
- name: Create, update, or close durable failure issue
env:
GH_TOKEN: ${{ github.token }}
PREPARE_RESULT: ${{ needs.prepare.result }}
PREPARE_STATE: ${{ needs.prepare.outputs.state }}
VERIFY_RESULT: ${{ needs.verify.result }}
PUBLISH_RESULT: ${{ needs.publish.result }}
LATEST_TAG_CONTEXT: ${{ needs.prepare.outputs.latest_tag }}
DRY_RUN_CONTEXT: ${{ needs.prepare.outputs.dry_run }}
run: .github/scripts/upstream-release-sync.sh notify