-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (102 loc) · 3.93 KB
/
Copy pathrelease.yml
File metadata and controls
107 lines (102 loc) · 3.93 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
name: Release
on:
push:
tags: ['v*']
jobs:
build:
name: build sdist + wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- run: uv build
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/*
publish-pypi:
name: publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/gmat-copilot
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
# Publish the VS Code extension (editors/vscode/) to the VS Code Marketplace and Open VSX. Auth is
# user-provided tokens stored as the VSCE_PAT and OVSX_PAT repository secrets. These must be created
# once before the first tag, alongside the registry identities they authenticate against — like the
# PyPI pending publisher, this is a one-time, user-only bootstrap:
# * VS Code Marketplace: create the `astro-tools` publisher at
# https://marketplace.visualstudio.com/manage, mint a PAT, store it as the VSCE_PAT secret.
# * Open VSX: create the `astro-tools` namespace, mint a token from the same account, store it as
# the OVSX_PAT secret.
# Until both exist the publish steps below skip silently (each is gated on its token being present),
# so a tag cut before the bootstrap is a harmless no-op rather than a failure. Each publish step is
# also idempotent: it checks the registry for the current version first, so re-running a tag whose
# extension version is already published is a no-op. The extension version is kept in lockstep with
# the package release.
publish-vscode:
name: publish VS Code extension
runs-on: ubuntu-latest
timeout-minutes: 15
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
defaults:
run:
working-directory: editors/vscode
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '22'
cache: npm
cache-dependency-path: editors/vscode/package-lock.json
- run: npm ci
- name: Package the .vsix
run: npx @vscode/vsce package --out gmat-copilot.vsix
- name: Publish to the VS Code Marketplace
if: env.VSCE_PAT != ''
run: |
version="$(node -p "require('./package.json').version")"
id="$(node -p "require('./package.json').publisher + '.' + require('./package.json').name")"
if npx @vscode/vsce show "${id}" --json > /tmp/ext.json 2>/dev/null \
&& node -e "process.exit((JSON.parse(require('fs').readFileSync('/tmp/ext.json','utf8')).versions||[]).some(v => v.version === '${version}') ? 0 : 1)"; then
echo "${id}@${version} is already on the Marketplace — skipping."
else
npx @vscode/vsce publish --packagePath gmat-copilot.vsix
fi
- name: Publish to Open VSX
if: env.OVSX_PAT != ''
run: |
version="$(node -p "require('./package.json').version")"
id="$(node -p "require('./package.json').publisher + '.' + require('./package.json').name")"
if npx ovsx get "${id}" -t "${version}" -o /tmp/ovsx.vsix > /dev/null 2>&1; then
echo "${id}@${version} is already on Open VSX — skipping."
else
npx ovsx publish gmat-copilot.vsix
fi
github-release:
name: github release
needs: publish-pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- env:
GH_TOKEN: ${{ github.token }}
run: gh release create "${GITHUB_REF_NAME}" --verify-tag --generate-notes dist/*