Skip to content

Merge pull request #289 from SimonStnn/dev #1

Merge pull request #289 from SimonStnn/dev

Merge pull request #289 from SimonStnn/dev #1

name: Build and Release
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '21'
- name: Install GitHub CLI
run: |
type -p curl >/dev/null || (apt update && apt install -y curl)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
apt update
apt install gh -y
- name: Install dependencies
run: npm install
- name: Build the project
run: npm run build:all:zip
- name: Get version from package.json
id: get_version
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
# Doesn't use actions/create-release@v1 and actions/upload-release-asset@v1 ebcause it doesn't support uploading multiple assets
- name: Create Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
assets=()
for asset in ./build/*.zip; do
assets+=("$asset")
done
tag_name="v${{ env.VERSION }}"
gh release create --generate-notes --latest "$tag_name"
gh release upload "$tag_name" "${assets[@]}"