Skip to content

Commit 80b76d4

Browse files
committed
chore(github actions): Add action to trigger release manually
1 parent c27f89d commit 80b76d4

File tree

3 files changed

+57
-8
lines changed

3 files changed

+57
-8
lines changed

.github/workflows/check-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: 'Setup node'
1515
uses: actions/setup-node@v4
1616
with:
17-
node-version: '18.x'
17+
node-version: '20.x'
1818
- name: 'Install dependencies'
1919
run: yarn
2020
# - name: 'Test configs'
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Make github and npm releases'
1+
name: 'Create github and npm releases'
22

33
on:
44
push:
@@ -9,14 +9,16 @@ jobs:
99
make-release:
1010
name: 'Make github and npm releases'
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
1214

1315
steps:
1416
- name: 'Checkout source code'
1517
uses: 'actions/checkout@v4'
1618
- name: 'Setup node'
1719
uses: actions/setup-node@v4
1820
with:
19-
node-version: '18.x'
21+
node-version: '20.x'
2022
registry-url: 'https://registry.npmjs.org'
2123
scope: '@dtrw'
2224
- name: 'Install dependencies'
@@ -31,11 +33,15 @@ jobs:
3133
run: "yarn publish --tag ${{ ((contains(github.ref_name, '-alpha') || contains(github.ref_name, '-beta')) && 'next') || 'latest' }} --access public"
3234
env:
3335
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
- name: Generate Changelog
37+
run: |
38+
START=$(grep -n "## \[" CHANGELOG.md | head -n 1 | cut -d : -f 1)
39+
END=$(grep -n "## \[" CHANGELOG.md | head -n 2 | tail -n 1 | cut -d : -f 1)
40+
awk "NR > $START && NR < $END" CHANGELOG.md | sed -e :a -e '/./,$!d;/^\n*$/{$d;N;};/\n$/ba' > ${{ github.workspace }}-CHANGELOG.temp.md
3441
- name: 'Create a github release'
35-
uses: "marvinpinto/action-automatic-releases@latest"
36-
# TODO: https://github.com/marvinpinto/actions/pull/642
37-
# TODO: body/content
42+
uses: softprops/action-gh-release@v2
3843
with:
39-
repo_token: "${{ secrets.GITHUB_TOKEN }}"
44+
token: "${{ secrets.GITHUB_TOKEN }}"
4045
prerelease: ${{ contains(github.ref_name, '-alpha') || contains(github.ref_name, '-beta') }}
41-
automatic_release_tag: "${{ github.ref_name }}"
46+
tag_name: "${{ github.ref_name }}"
47+
body_path: ${{ github.workspace }}-CHANGELOG.temp.md
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Trigger a release'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
alpha:
7+
type: boolean
8+
description: 'Alpha release?'
9+
10+
jobs:
11+
default:
12+
name: 'Trigger a release'
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- name: 'Checkout source code'
19+
uses: 'actions/checkout@v4'
20+
- name: 'Setup node'
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20.x'
24+
- name: 'Install dependencies'
25+
run: yarn
26+
# - name: 'Test configs'
27+
# run: yarn test
28+
- name: 'Lint configs'
29+
run: yarn lint
30+
- name: 'Setup git'
31+
run: |
32+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
33+
git config --local user.name "github-actions[bot]"
34+
- name: 'Create release'
35+
if: ${{ !github.event.inputs.alpha }}
36+
run: yarn release
37+
- name: 'Create alpha release'
38+
if: ${{ github.event.inputs.alpha }}
39+
run: yarn release:alpha
40+
- name: 'Push release'
41+
uses: ad-m/github-push-action@master
42+
with:
43+
branch: master

0 commit comments

Comments
 (0)