-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (79 loc) · 2.99 KB
/
Copy pathrelease.yml
File metadata and controls
93 lines (79 loc) · 2.99 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: Release tag to publish, for example v1.0.0.
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Use npm registry
run: npm config set registry https://registry.npmjs.org/
- name: Install
timeout-minutes: 10
run: npm ci --prefer-offline --no-audit
- name: Package VSIX
run: npm run package:vsix
- name: Verify VSIX contents
run: npm run verify:vsix-contents
- name: Wait for CI on this commit
env:
GH_TOKEN: ${{ github.token }}
run: |
for attempt in $(seq 1 60); do
status="$(gh run list --repo "$GITHUB_REPOSITORY" --workflow CI --commit "$GITHUB_SHA" --event push --limit 1 --json status --jq '.[0].status // ""')"
conclusion="$(gh run list --repo "$GITHUB_REPOSITORY" --workflow CI --commit "$GITHUB_SHA" --event push --limit 1 --json conclusion --jq '.[0].conclusion // ""')"
url="$(gh run list --repo "$GITHUB_REPOSITORY" --workflow CI --commit "$GITHUB_SHA" --event push --limit 1 --json url --jq '.[0].url // ""')"
if [ "$status" = "completed" ] && [ "$conclusion" = "success" ]; then
echo "CI passed: $url"
exit 0
fi
if [ "$status" = "completed" ]; then
echo "CI did not pass: ${conclusion:-unknown} $url"
exit 1
fi
echo "Waiting for CI on $GITHUB_SHA, attempt $attempt/60..."
sleep 30
done
echo "Timed out waiting for CI on $GITHUB_SHA."
exit 1
- name: Publish to VS Code Marketplace
if: env.VSCE_PAT != ''
run: npx @vscode/vsce publish --packagePath dist/super-markdown.vsix --skip-duplicate -p "$VSCE_PAT"
- name: Publish to Open VSX
if: env.OVSX_PAT != ''
run: |
for attempt in 1 2 3 4 5; do
npx ovsx publish dist/super-markdown.vsix \
--skip-duplicate \
--baseContentUrl "https://github.com/${GITHUB_REPOSITORY}/blob/${RELEASE_TAG}/" \
--baseImagesUrl "https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/${RELEASE_TAG}/" \
-p "$OVSX_PAT" && exit 0
if [ "$attempt" = "5" ]; then
exit 1
fi
sleep $((attempt * 30))
done
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
files: dist/super-markdown.vsix