Prerelease #6
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
name: Prerelease | |
env: | |
HUSKY: 0 | |
on: workflow_dispatch | |
jobs: | |
create-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create-release.outputs.result }} | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
ref: release | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: get version | |
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
- name: create release | |
id: create-release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { data } = await github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: `v${process.env.PACKAGE_VERSION}-prerelease`, | |
target_commitish: 'main', | |
name: `qSpider v${process.env.PACKAGE_VERSION} prerelease`, | |
body: 'Take a look at the assets to download and install this app.', | |
draft: true, | |
prerelease: true | |
}) | |
return data.id | |
build-web: | |
needs: [create-release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
ref: release | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build | |
- name: Archive Release | |
uses: thedoctor0/zip-release@master | |
with: | |
filename: 'qspider-player.zip' | |
path: . | |
directory: dist/apps/player | |
- name: Upload Release Asset | |
uses: actions/github-script@v7 | |
env: | |
release_id: ${{ needs.create-release.outputs.release_id }} | |
with: | |
script: | | |
const fs = require('fs'); | |
// Upload the release asset | |
await github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.release_id, | |
name: "qspider-player.zip", | |
data: await fs.readFileSync('dist/apps/player/qspider-player.zip') | |
}); | |
build-web-standalone: | |
needs: [create-release] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
ref: release | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build:standalone | |
- name: Archive Release | |
uses: thedoctor0/zip-release@master | |
with: | |
filename: 'qspider-player-standalone.zip' | |
path: . | |
directory: dist/apps/player-standalone | |
- name: Upload Release Asset | |
uses: actions/github-script@v7 | |
env: | |
release_id: ${{ needs.create-release.outputs.release_id }} | |
with: | |
script: | | |
const fs = require('fs'); | |
// Upload the release asset | |
await github.rest.repos.uploadReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.release_id, | |
name: "qspider-player-standalone.zip", | |
data: await fs.readFileSync('dist/apps/player-standalone/qspider-player-standalone.zip') | |
}); | |
build-desktop: | |
needs: [create-release] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: 'macos-latest' | |
args: '' | |
- platform: 'ubuntu-20.04' | |
args: '' | |
- platform: 'windows-latest' | |
args: '' | |
runs-on: ${{ matrix.platform }} | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
ref: release | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. | |
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- name: install webkit2gtk (ubuntu only) | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf | |
- run: npm ci | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
with: | |
releaseId: ${{ needs.create-release.outputs.release_id }} | |
updaterJsonPreferNsis: true | |
args: ${{ matrix.args }} |