-
Notifications
You must be signed in to change notification settings - Fork 30
70 lines (57 loc) · 2.21 KB
/
release.yml
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
name: Release Workflow
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_registry: "https://registry.npmjs.org"
jobs:
publish-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
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: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# Put date in the title and commit message
title: "Theme Tools Release — ${{ steps.date.outputs.date }}"
commit: "Theme Rools 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_TOKEN: ${{ secrets.NPM_TOKEN }}
- 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