-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (73 loc) · 2.5 KB
/
Copy pathrelease.yml
File metadata and controls
84 lines (73 loc) · 2.5 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
name: release
on:
workflow_dispatch:
inputs:
publish:
description: "Publish npm, PyPI, crates.io, and VS Code Marketplace packages"
required: true
default: "false"
type: choice
options:
- "false"
- "true"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
id-token: write
jobs:
release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
registry-url: "https://registry.npmjs.org"
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: dtolnay/rust-toolchain@stable
- run: npm ci
- run: python -m pip install build twine
- run: npm run check:release
- name: Validate publish secrets
if: ${{ inputs.publish == 'true' }}
shell: pwsh
run: |
$missing = @()
if (-not "${{ secrets.NPM_TOKEN }}") { $missing += "NPM_TOKEN" }
if (-not "${{ secrets.PYPI_API_TOKEN }}") { $missing += "PYPI_API_TOKEN" }
if (-not "${{ secrets.CARGO_REGISTRY_TOKEN }}") { $missing += "CARGO_REGISTRY_TOKEN" }
if (-not "${{ secrets.VSCE_PAT }}") { $missing += "VSCE_PAT" }
if ($missing.Count -gt 0) {
throw "Missing GitHub Actions secrets: $($missing -join ', ')"
}
- uses: actions/upload-artifact@v4
with:
name: release-artifacts
path: |
lessmark-*.tgz
packages/python/dist/*
editors/vscode/*.vsix
if-no-files-found: error
- name: Publish npm
if: ${{ inputs.publish == 'true' }}
run: npm publish --workspace lessmark --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish PyPI
if: ${{ inputs.publish == 'true' }}
run: python -m twine upload packages/python/dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish crates.io
if: ${{ inputs.publish == 'true' }}
run: cargo publish --manifest-path crates/lessmark/Cargo.toml --token "${{ secrets.CARGO_REGISTRY_TOKEN }}"
- name: Publish VS Code Marketplace
if: ${{ inputs.publish == 'true' }}
working-directory: editors/vscode
run: npx --yes @vscode/vsce publish -p "${{ secrets.VSCE_PAT }}"