Skip to content

Commit 1d07d67

Browse files
committed
👷 Add releaser action
1 parent 8d74bd6 commit 1d07d67

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflows/releaser.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Publish new release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
9+
default: 'latest'
10+
type: string
11+
12+
permissions: write-all
13+
14+
env:
15+
WARDUINO: 'warduino'
16+
17+
jobs:
18+
create-release:
19+
runs-on: ubuntu-latest
20+
steps:
21+
# clone latch
22+
- uses: actions/checkout@v4
23+
24+
# update version
25+
- name: Update version in package.json
26+
run: |
27+
sed -i 's/"version": "[^"]*"/"version": "${{ env.VERSION }}"/' package.json
28+
env:
29+
VERSION: ${{ inputs.version }}
30+
31+
# clone warduino
32+
- uses: actions/checkout@v4
33+
with:
34+
repository: 'TOPLLab/WARDuino'
35+
path: 'warduino'
36+
ssh-key: ${{ secrets.WARDUINO_DEPLOY }}
37+
38+
# update package
39+
- name: Bump latch version for WARDuino
40+
run: |
41+
rm ${GITHUB_WORKSPACE}/${WARDUINO}/tests/latch/*.tgz
42+
npm i
43+
npm run build
44+
npm pack --pack-destination ${GITHUB_WORKSPACE}/${WARDUINO}/tests/latch/
45+
46+
# update package.json
47+
- name: Update package.json in WARDuino
48+
run: |
49+
cd tests/latch
50+
sed -i "s|\"latch\": \"file:./latch-[^\"]*\"|\"latch\": \"file:./latch-$VERSION.tgz\"|" package.json
51+
working-directory: 'warduino'
52+
env:
53+
VERSION: ${{ inputs.version }}
54+
55+
# commit
56+
- name: Push changes
57+
run: |
58+
git config user.name 'github-actions[bot]'
59+
git config user.email 'github-actions[bot]@users.noreply.github.com'
60+
git add tests/latch/
61+
git checkout -b bump/latch-$VERSION
62+
git commit -m "⬆️ Bump latch version"
63+
git push --set-upstream origin bump/latch-$VERSION
64+
working-directory: 'warduino'
65+
env:
66+
VERSION: ${{ inputs.version }}
67+
68+
# create pull request
69+
- name: Create Pull Request
70+
run: |
71+
gh pr create --title "⬆️ Bump latch to $VERSION" --body "Bumping latch to \`$VERSION\`" --base main --head bump/latch-$VERSION --label dependencies
72+
working-directory: 'warduino'
73+
env:
74+
VERSION: ${{ inputs.version }}
75+
GH_TOKEN: ${{ secrets.WARDUINO_LATCH }}
76+

0 commit comments

Comments
 (0)