Skip to content

Commit 8184c10

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

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/releaser.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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 run build
43+
npm pack --pack-destination ${GITHUB_WORKSPACE}/${WARDUINO}/tests/latch/
44+
45+
# update package.json
46+
- name: Update package.json in WARDuino
47+
run: |
48+
cd tests/latch
49+
sed -i "s|\"latch\": \"file:./latch-[^\"]*\"|\"latch\": \"file:./latch-$VERSION.tgz\"|" package.json
50+
working-directory: 'warduino'
51+
env:
52+
VERSION: ${{ inputs.version }}
53+
54+
# commit
55+
- name: Push changes
56+
run: |
57+
git config user.name 'github-actions[bot]'
58+
git config user.email 'github-actions[bot]@users.noreply.github.com'
59+
git add tests/latch/
60+
git checkout -b bump/latch-$VERSION
61+
git commit -m "⬆️ Bump latch version"
62+
git push --set-upstream origin bump/latch-$VERSION
63+
working-directory: 'warduino'
64+
env:
65+
VERSION: ${{ inputs.version }}
66+
67+
# create pull request
68+
- name: Create Pull Request
69+
run: |
70+
gh pr create --title "⬆️ Bump latch to $VERSION" --body "Bumping latch to \`$VERSION\`" --base main --head bump/latch-$VERSION --label dependencies
71+
working-directory: 'warduino'
72+
env:
73+
VERSION: ${{ inputs.version }}
74+
GH_TOKEN: ${{ secrets.WARDUINO_LATCH }}
75+

0 commit comments

Comments
 (0)