Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: main
pull_request:
branches: main
workflow_dispatch:
# workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/build-plugin-snapshot-zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Plugin snapshot ZIP
on:
pull_request:
branches: main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3.2.0
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- run: npm install shx -g
- run: npm install rollup -g
- name: Install libudev-dev and libusb-dev
run: sudo apt-get install -y libusb-1.0-0-dev libudev-dev
- name: Build release zip
run: ./release.sh
shell: bash
env:
PR_NUMBER: ${{ github.event.number }}
- name: Archive zip
uses: actions/upload-artifact@v3
with:
name: controller-tools
path: controller-tools-*.zip
26 changes: 22 additions & 4 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@
rm -rf build
mkdir -p build/bin

npm run build
npm install

pnpm run build
cp -r dist build/

VERSION=$(cat package.json| jq -r '.version')
SHA=$(git rev-parse --short HEAD)
if [ -n "$PR_NUMBER" ]; then
echo "Build release for PR $PR_NUMBER"
VERSION="$VERSION-beta+$PR_NUMBER.sha.$SHA"
sed -i -e 's/^version = .*/version = "'$VERSION'"/' ./backend/Cargo.toml
sed -i -e 's/"version": .*/\"version\": "'$VERSION'",/' package.json
cat ./backend/Cargo.toml
cat package.json
else
echo "Building release"
fi

cargo build --release --manifest-path backend/Cargo.toml
cp ./backend/target/release/controller-tools build/bin/backend

Expand All @@ -16,7 +31,10 @@ cp README.md build/README.md
cp LICENSE build/LICENSE

mv build ControllerTools
VERSION=$(cat package.json| jq -r '.version')
rm -f controller-tools-$VERSION.zip
rm -f controller-tools-*.zip
zip -r controller-tools-$VERSION.zip ControllerTools/*
mv ControllerTools build
mv ControllerTools build

if [ -n "$PR_NUMBER" ]; then
git checkout -- backend/Cargo.toml package.json
fi