Merge pull request #107 from jackschedel/2.0.8d #129
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 and publish desktop app | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
id-token: write | |
concurrency: | |
group: releases | |
cancel-in-progress: true | |
jobs: | |
build: | |
if: "!contains(github.event.head_commit.message, '[skip release]')" | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version from package.json | |
id: packageJson | |
run: echo "PACKAGE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache yarn dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn | |
- name: Cache release assets | |
uses: actions/cache@v3 | |
with: | |
path: ./release | |
key: ${{ runner.os }}-release-${{github.sha}} | |
restore-keys: | | |
${{ runner.os }}-release- | |
- name: Build | |
run: yarn make | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VITE_GOOGLE_CLIENT_ID: ${{ secrets.GCLIENT }} | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: release-${{ runner.os }} | |
path: ./release | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version from package.json | |
id: packageJson | |
run: echo "PACKAGE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.sha }}-${{ github.run_id }} | |
release_name: v${{env.PACKAGE_VERSION}} | |
draft: true | |
prerelease: false | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v2 | |
- name: Upload Release Asset - Ubuntu | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release-Linux/koala-client-${{env.PACKAGE_VERSION}}-linux-x86_64.AppImage | |
asset_name: KoalaClient-${{env.PACKAGE_VERSION}}-linux-x86_64.AppImage | |
asset_content_type: application | |
- name: Upload Release Asset - MacOS | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release-macOS/koala-client-${{env.PACKAGE_VERSION}}-mac-x64.dmg | |
asset_name: KoalaClient-${{env.PACKAGE_VERSION}}-mac-x64.dmg | |
asset_content_type: application | |
- name: Upload Release Asset - Windows | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release-Windows/koala-client-${{env.PACKAGE_VERSION}}-win-x64.exe | |
asset_name: KoalaClient-${{env.PACKAGE_VERSION}}-win-x64.exe | |
asset_content_type: application | |
- name: Zip Unpacked Release - Windows | |
run: | | |
cd ./release-Windows | |
7z a win-unpacked.zip win-unpacked/ | |
cd .. | |
- name: Upload Unpacked Release - Windows | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release-Windows/win-unpacked.zip | |
asset_name: KoalaClient-${{env.PACKAGE_VERSION}}-win-x64-portable.zip | |
asset_content_type: zip | |
- name: Zip Hash Info | |
run: | | |
7z a hash-info.zip ./release-Linux/latest-linux.yml ./release-macOS/latest-mac.yml | |
cp ./release-Windows/latest.yml ./release-Windows/latest-windows.yml | |
7z a hash-info.zip ./release-Windows/latest-windows.yml | |
- name: Upload Hash Info | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./hash-info.zip | |
asset_name: hash-info.zip | |
asset_content_type: zip |