Skip to content

Commit 7585ef2

Browse files
Merge pull request #6704 from Shopify/unify-release-workflows
Unify release workflows
2 parents e794f12 + 9fc744a commit 7585ef2

File tree

6 files changed

+94
-104
lines changed

6 files changed

+94
-104
lines changed

.github/workflows/release-manual.yaml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
1-
name: Changeset Release
1+
name: Release
22

33
on:
4-
workflow_dispatch:
4+
# Trigger for snapit functionality
5+
issue_comment:
6+
types:
7+
- created
8+
9+
# Trigger for changeset release functionality
510
push:
611
branches:
712
- main
813
- stable/3.*
914

15+
# Trigger for manual/cron release functionality
16+
schedule:
17+
- cron: '0 6 * * *' # 6:00 AM UTC every day
18+
19+
workflow_dispatch:
20+
inputs:
21+
tag:
22+
description: 'Tag'
23+
default: 'nightly'
24+
type: choice
25+
options:
26+
- nightly
27+
- latest
28+
- experimental
29+
1030
concurrency:
1131
group: changeset-${{ github.head_ref || github.run_id }}
1232
cancel-in-progress: true
@@ -16,8 +36,48 @@ env:
1636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1737

1838
jobs:
39+
# Snapit job - runs when /snapit comment is made on a PR
40+
snapit:
41+
name: Snapit
42+
if: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.body == '/snapit' }}
43+
runs-on: ubuntu-latest
44+
steps:
45+
# WARNING: DO NOT RUN ANY CUSTOM LOCAL SCRIPT BEFORE RUNNING THE SNAPIT ACTION
46+
# This action can be executed by 3rd party users and it should not be able to run arbitrary code from a PR.
47+
- name: Checkout current branch
48+
uses: actions/checkout@v4
49+
- name: Install pnpm
50+
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # [email protected]
51+
with:
52+
version: ${{ env.PNPM_VERSION }}
53+
run_install: false
54+
- name: Force snapshot changeset
55+
run: "mv .changeset/force-snapshot-build.md.ignore .changeset/force-snapshot-build.md"
56+
- name: Create snapshot version
57+
uses: Shopify/snapit@8dacdbe980a7628cf65d9b1d838ee7103450c6b8
58+
with:
59+
global_install: 'true'
60+
github_comment_included_packages: '@shopify/cli'
61+
custom_message_suffix: "
62+
> [!CAUTION]
63+
64+
> After installing, validate the version by running just `shopify` in your terminal.
65+
66+
> If the versions don't match, you might have multiple global instances installed.
67+
68+
> Use `which shopify` to find out which one you are running and uninstall it."
69+
package_manager: 'npm'
70+
shopify_registry: 'https://registry.npmjs.org'
71+
build_script: "pnpm nx run-many --target=bundle --all --skip-nx-cache --output-style=stream && pnpm refresh-manifests"
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
75+
SHOPIFY_CLI_BUILD_REPO: ${{ github.repository }}
76+
77+
# Changeset release job - runs on push to main or stable branches
1978
changeset-release:
2079
name: Changeset Release
80+
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag == '') }}
2181
runs-on: ubuntu-latest
2282
permissions:
2383
contents: write
@@ -43,3 +103,35 @@ jobs:
43103
NPM_CONFIG_PROVENANCE: true
44104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45105
SHOPIFY_CLI_BUILD_REPO: ${{ github.repository }}
106+
107+
# Manual/Cron release job - runs on schedule or manual trigger with tag
108+
manual-cron-release:
109+
name: Manual & Cron Release
110+
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '') }}
111+
runs-on: ubuntu-latest
112+
permissions:
113+
contents: write
114+
pull-requests: write
115+
id-token: write
116+
steps:
117+
- uses: actions/checkout@v3
118+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
119+
with:
120+
fetch-depth: 1
121+
- name: Setup deps
122+
uses: ./.github/actions/setup-cli-deps
123+
with:
124+
node-version: 24.1.0
125+
- name: Creating .npmrc
126+
run: |
127+
cat << EOF > "$HOME/.npmrc"
128+
//registry.npmjs.org/:_authToken=$NPM_TOKEN
129+
EOF
130+
env:
131+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
132+
- name: Release
133+
run: pnpm release ${{ github.event.inputs.tag || 'nightly' }}
134+
env:
135+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136+
NPM_CONFIG_PROVENANCE: true
137+
SHOPIFY_CLI_BUILD_REPO: ${{ github.repository }}

.github/workflows/snapit.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)