-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | ||
|