-
Notifications
You must be signed in to change notification settings - Fork 11
101 lines (85 loc) · 2.44 KB
/
Copy pathpublish.yml
File metadata and controls
101 lines (85 loc) · 2.44 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
name: Publish Package
on:
workflow_dispatch:
inputs:
tag:
description: 'npm tag (latest or next)'
required: true
type: choice
options:
- latest
- next
repository_dispatch:
types: [publish-package]
permissions:
id-token: write
contents: read
jobs:
publish:
runs-on: ubuntu-latest
outputs:
requested_tag: ${{ steps.publish.outputs.requested_tag }}
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
with:
install: true
cache: true
experimental: true
- name: Setup
run: mise run setup
- name: Build
run: mise run build
- id: inputs
uses: simenandre/setup-inputs@v1
- name: Publish candidate to npm with OIDC
id: publish
run: |
TAG="${{ steps.inputs.outputs.tag }}"
if [ -z "$TAG" ]; then
TAG="latest"
fi
echo "requested_tag=$TAG" >> "$GITHUB_OUTPUT"
CANDIDATE_TAG="next"
echo "Publishing candidate with tag: $CANDIDATE_TAG (requested: $TAG)"
mise run publish --tag "$CANDIDATE_TAG"
- name: Resolve published version
id: version
run: |
VERSION=$(npm view opencode-synced@next version)
if [ -z "$VERSION" ]; then
echo "Failed to resolve version from npm tag: next"
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
smoke:
needs: publish
uses: ./.github/workflows/opencode-smoke.yml
with:
tag: next
timeout: 20
continue-on-error: true
promote_latest:
needs: [publish, smoke]
if: needs.publish.outputs.requested_tag == 'latest'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
with:
install: true
cache: true
experimental: true
- name: Promote latest dist-tag
run: |
VERSION="${{ needs.publish.outputs.version }}"
if [ -z "$VERSION" ]; then
echo "Missing published version."
exit 1
fi
echo "Promoting opencode-synced@$VERSION to latest"
npm dist-tag add "opencode-synced@$VERSION" latest