-
Notifications
You must be signed in to change notification settings - Fork 77
85 lines (70 loc) · 3 KB
/
release.yml
File metadata and controls
85 lines (70 loc) · 3 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
name: Release Workflow
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OPENVSX_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_registry: "https://registry.npmjs.org"
jobs:
publish-packages:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24 # Needed for npm@11 for Trusted Publishing
registry-url: "https://registry.npmjs.org"
cache: "yarn"
cache-dependency-path: "yarn.lock"
- name: Install the packages
run: yarn install --frozen-lockfile --ignore-engines
- name: Build the code
run: yarn build
env:
NODE_ENV: production
- name: Grab date as YYYY-MM-DD
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Query VS Code Marketplace version
id: marketplace-version
run: echo "version=$(yarn --silent vsce show --json Shopify.theme-check-vscode | jq -r .versions[0].version)" >> $GITHUB_OUTPUT
- name: Query VS Code Package version (Before running changeset version)
id: package-version
run: echo "version=$(jq -r .version packages/vscode-extension/package.json)" >> $GITHUB_OUTPUT
- name: Test OIDC Token
run: |
TOKEN=$(curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=npm" | jq -r '.value')
[ -n "$TOKEN" ] && echo "✅ OIDC working" || exit 1
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1.7.0
with:
# Put date in the title and commit message
title: "Theme Tools Release — ${{ steps.date.outputs.date }}"
commit: "Theme Tools Release — ${{ steps.date.outputs.date }}"
# When there are no changesets, this gets called
publish: yarn changeset publish
# When there are changesets, this gets called and then a PR is opened/updated
version: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
- name: VS Code Marketplace publish
if: steps.changesets.outputs.hasChangesets == 'false' && steps.marketplace-version.outputs.version != steps.package-version.outputs.version
run: yarn publish:vsce
- name: Open VSX Registry publish
if: steps.changesets.outputs.hasChangesets == 'false' && steps.marketplace-version.outputs.version != steps.package-version.outputs.version
run: yarn publish:ovsx