Skip to content

Commit 9c75158

Browse files
authored
feat: release action support comment trigger (#2040)
* feat: release workflow support issue_comment trigger * fix: relesae action add if condition
1 parent b59c1d4 commit 9c75158

File tree

1 file changed

+44
-8
lines changed

1 file changed

+44
-8
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,55 @@ on:
1313
- alpha
1414
- beta
1515
- latest
16+
issue_comment:
17+
types: [created]
1618

1719
jobs:
20+
issue_commentd:
21+
name: Release with commentd
22+
if: github.event.issue.pull_request && contains(github.event.comment.body, '!canary')
23+
runs-on: [self-hosted, rspack-common, macOS, ARM64, release]
24+
steps:
25+
- name: Checkout Repo
26+
uses: actions/checkout@v3
27+
with:
28+
# This makes Actions fetch only one branch to release
29+
fetch-depth: 1
30+
ref: refs/pull/${{ github.event.issue.number }}/head
31+
- name: Install rus toolchain
32+
uses: actions-rs/toolchain@v1
33+
with:
34+
toolchain: nightly-2022-08-06
35+
profile: default
36+
components: rustfmt, clippy, cargo
37+
- uses: actions/setup-node@v3
38+
with:
39+
node-version: "16"
40+
architecture: "arm64"
41+
- name: Install node_modules
42+
run: |
43+
npm install -g [email protected]
44+
pnpm -v
45+
pnpm install
46+
- name: Build
47+
run: ./x build cli:release:all
48+
- name: Release
49+
uses: modern-js-dev/actions@v2
50+
with:
51+
# this expects you to have a script called release which does a build for your packages and calls changeset publish
52+
version: "canary"
53+
type: "release"
54+
branch: ""
55+
tools: "changeset"
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
59+
REPOSITORY: ${{ github.repository }}
60+
PULL_REQUEST_NUMBER: ${{ github.event.issue.number }}
1861
release:
1962
name: Release
2063
runs-on: [self-hosted, rspack-common, macOS, ARM64, release]
21-
64+
if: ${{ github.event_name == 'workflow_dispatch' }}
2265
steps:
2366
- name: Checkout Repo
2467
uses: actions/checkout@master
@@ -55,10 +98,3 @@ jobs:
5598
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5699
REPOSITORY: ${{ github.repository }}
57100
REF: ${{ github.ref }}
58-
- name: Write a new comment
59-
uses: peter-evans/[email protected]
60-
continue-on-error: true
61-
with:
62-
issue-number: ${{ github.event.issue.number }}
63-
body: |
64-
${{ steps.release.outputs.comment }}

0 commit comments

Comments
 (0)