-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (63 loc) · 2.18 KB
/
Copy pathrelease.yml
File metadata and controls
73 lines (63 loc) · 2.18 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
name: Release new version
on:
workflow_dispatch:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install & Build
run: |
npm ci
npm run package
- name: Prepare artifacts
id: prepare-artifacts
run: |
mkdir artifacts
cp dist/*.vsix artifacts
# Record the VSIX path as an output of this step.
# This will be used later when uploading a release asset.
VSIX_PATH="$(ls dist/*.vsix)"
echo "vsix_path=$VSIX_PATH" >> "$GITHUB_OUTPUT"
# Transform the GitHub ref so it can be used in a filename.
# The last sed invocation is used for testing branches that modify this workflow.
REF_NAME="$(echo ${{ github.ref }} | sed -e 's:^refs/tags/::' | sed -e 's:/:-:g')"
echo "ref_name=$REF_NAME" >> "$GITHUB_OUTPUT"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: vscode-chronoly-extension
path: artifacts
- name: Create release
id: create-release
run: |
# Define variables for paths and names
VSIX_PATH="${{ steps.prepare-artifacts.outputs.vsix_path }}"
VSIX_NAME="${{ format('chronoly-{0}.vsix', steps.prepare-artifacts.outputs.ref_name) }}"
# Create the release
gh release create "${{ github.ref_name }}" --draft --title "Release ${{ github.ref_name }}" \
"$VSIX_PATH#$VSIX_NAME"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
vscode-publish:
name: Publish to VS Code Marketplace
needs: build
environment: publish-vscode-marketplace
runs-on: ubuntu-latest
env:
VS_MARKETPLACE_PAT: ${{ secrets.VS_MARKETPLACE_PAT }}
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vscode-chronoly-extension
- name: Publish to Registry
run: |
npx @vscode/vsce publish -p $VS_MARKETPLACE_PAT --packagePath *.vsix