Skip to content

Commit

Permalink
👷 Add releaser action
Browse files Browse the repository at this point in the history
  • Loading branch information
tolauwae committed Dec 3, 2024
1 parent 8d74bd6 commit 1d07d67
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Publish new release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
default: 'latest'
type: string

permissions: write-all

env:
WARDUINO: 'warduino'

jobs:
create-release:
runs-on: ubuntu-latest
steps:
# clone latch
- uses: actions/checkout@v4

# update version
- name: Update version in package.json
run: |
sed -i 's/"version": "[^"]*"/"version": "${{ env.VERSION }}"/' package.json
env:
VERSION: ${{ inputs.version }}

# clone warduino
- uses: actions/checkout@v4
with:
repository: 'TOPLLab/WARDuino'
path: 'warduino'
ssh-key: ${{ secrets.WARDUINO_DEPLOY }}

# update package
- name: Bump latch version for WARDuino
run: |
rm ${GITHUB_WORKSPACE}/${WARDUINO}/tests/latch/*.tgz
npm i
npm run build
npm pack --pack-destination ${GITHUB_WORKSPACE}/${WARDUINO}/tests/latch/
# update package.json
- name: Update package.json in WARDuino
run: |
cd tests/latch
sed -i "s|\"latch\": \"file:./latch-[^\"]*\"|\"latch\": \"file:./latch-$VERSION.tgz\"|" package.json
working-directory: 'warduino'
env:
VERSION: ${{ inputs.version }}

# commit
- name: Push changes
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add tests/latch/
git checkout -b bump/latch-$VERSION
git commit -m "⬆️ Bump latch version"
git push --set-upstream origin bump/latch-$VERSION
working-directory: 'warduino'
env:
VERSION: ${{ inputs.version }}

# create pull request
- name: Create Pull Request
run: |
gh pr create --title "⬆️ Bump latch to $VERSION" --body "Bumping latch to \`$VERSION\`" --base main --head bump/latch-$VERSION --label dependencies
working-directory: 'warduino'
env:
VERSION: ${{ inputs.version }}
GH_TOKEN: ${{ secrets.WARDUINO_LATCH }}

0 comments on commit 1d07d67

Please sign in to comment.