-
Notifications
You must be signed in to change notification settings - Fork 53
98 lines (86 loc) · 2.89 KB
/
rescue.yml
File metadata and controls
98 lines (86 loc) · 2.89 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
name: Rescue Publish
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Existing release tag to publish, e.g. v0.3.0.'
required: true
type: string
publish_vscode_marketplace:
description: Publish this tag to the VS Code Marketplace.
required: false
type: boolean
default: true
publish_open_vsx:
description: Publish this tag to Open VSX.
required: false
type: boolean
default: true
attach_github_release:
description: Attach the VSIX to the existing GitHub Release.
required: false
type: boolean
default: true
jobs:
publish:
runs-on: ubuntu-latest
environment: production
concurrency:
group: publish-${{ inputs.tag_name }}
cancel-in-progress: false
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: refs/tags/${{ inputs.tag_name }}
- name: Validate requested tag matches checked out commit
shell: bash
run: |
git fetch --force --tags
tag_ref="refs/tags/${{ inputs.tag_name }}"
if ! git rev-parse --verify "${tag_ref}" >/dev/null 2>&1; then
echo "Tag ${tag_ref} does not exist." >&2
exit 1
fi
head_commit="$(git rev-parse HEAD)"
tag_commit="$(git rev-list -n 1 "${tag_ref}")"
if [ "${head_commit}" != "${tag_commit}" ]; then
echo "Checked out commit ${head_commit} does not match tag ${tag_ref} (${tag_commit})." >&2
exit 1
fi
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- run: npm ci
- run: rm -rf dist && mkdir -p dist && npm run package
- name: Locate VSIX
id: vsix
shell: bash
run: |
shopt -s nullglob
files=(dist/*.vsix)
if [ "${#files[@]}" -ne 1 ]; then
echo "Expected exactly one VSIX in dist, found ${#files[@]}" >&2
printf '%s\n' "${files[@]}" >&2
exit 1
fi
echo "path=${files[0]}" >> "$GITHUB_OUTPUT"
- name: Publish to VS Code Marketplace
if: inputs.publish_vscode_marketplace == true
run: npm exec -- vsce publish --packagePath "${{ steps.vsix.outputs.path }}" --skip-duplicate
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Publish to Open VSX
if: inputs.publish_open_vsx == true
run: npm exec -- ovsx publish --skip-duplicate "${{ steps.vsix.outputs.path }}"
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
- name: Attach VSIX to GitHub Release
if: inputs.attach_github_release == true
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag_name }}
files: ${{ steps.vsix.outputs.path }}
fail_on_unmatched_files: true