build #43
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: 'build' | |
on: | |
workflow_dispatch: | |
jobs: | |
publish-tauri: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: 'macos-latest' # for Macos universal. | |
args: '--target universal-apple-darwin' | |
- platform: 'ubuntu-20.04' # for Tauri v1 you could replace this with ubuntu-20.04. | |
args: '' | |
- platform: 'windows-latest' | |
args: '' | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf | |
env: | |
CI: false | |
- name: Install Tauri CLI | |
run: npm install -g @tauri-apps/cli | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
npm run build | |
cp -r dist Dwarfium | |
echo "python3 -m http.server" > Dwarfium/start_server.bat | |
zip -r Dwarfium.zip Dwarfium | |
- name: Get version number from package.json | |
id: get_version | |
run: echo "::set-output name=version::$(node -e 'console.log(require("./package.json").version)')" | |
- name: Create artifact Dwarfium | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Dwarfium-${{ steps.get_version.outputs.version }} | |
path: Dwarfium.zip | |
- name: install frontend dependencies | |
run: npm install | |
env: | |
CI: false | |
- uses: tauri-apps/tauri-action@v0 | |
id: tauri_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
CI: false | |
with: | |
tagName: app-v${{ steps.get_version.outputs.version }} | |
releaseName: 'v${{ steps.get_version.outputs.version }}-DesktopAPP' | |
releaseBody: 'See the assets to download this version and install.' | |
releaseDraft: false | |
prerelease: false | |
includeUpdaterJson: true | |
updaterJsonKeepUniversal: false | |
- name: Release with ncipollo/release-action | |
if: matrix.platform == 'ubuntu-20.04' | |
id: release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: Dwarfium.zip | |
token: ${{ secrets.GITHUB_TOKEN }} | |
generateReleaseNotes: true | |
skipIfReleaseExists: true | |
tag: v${{ steps.get_version.outputs.version }} | |
update-gist: | |
runs-on: ubuntu-latest | |
needs: [publish-tauri] | |
steps: | |
- name: Get latest release | |
id: get_latest_release | |
uses: actions/github-script@v4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { owner, repo } = context.repo; | |
const response = await github.repos.listReleases({ owner, repo }); | |
const latestTag = response.data | |
.filter(release => release.tag_name.startsWith('app-v')) | |
.map(release => release.tag_name) | |
.sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' })) | |
.pop(); | |
return latestTag; | |
- name: Download latest.json | |
run: | | |
latest_release_tag=${{ steps.get_latest_release.outputs.result }} | |
latest_json_url="https://github.com/${GITHUB_REPOSITORY}/releases/download/${latest_release_tag}/latest.json" | |
curl -L "$latest_json_url" -o latest.json | |
- name: Update Gist | |
uses: exuanbo/actions-deploy-gist@v1 | |
with: | |
token: ${{ secrets.TOKEN }} | |
gist_id: ${{ secrets.GIST_ID }} | |
file_path: latest.json | |
file_type: text | |
gist_description: "Updater JSON for the latest release" | |
gist_file_name: "latest.json" |