Skip to content

publish

publish #71

Workflow file for this run

name: 'Publish'
on:
push:
branches:
- release
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-20.04
outputs:
release_id: ${{ steps.create-release.outputs.result }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Get version
run: echo "PACKAGE_VERSION=$(node -p "require('./src-tauri/tauri.conf.json').package.version")" >> $GITHUB_ENV
- name: Create release
id: create-release
uses: actions/github-script@v6
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${process.env.PACKAGE_VERSION}`,
name: ` v${process.env.PACKAGE_VERSION}`,
body: 'Take a look at the assets to download and install this app.',
draft: true,
prerelease: false
})
return data.id
build:
name: Build and Upload Release Asset
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'macos-latest'
args: '--target universal-apple-darwin'
- platform: 'ubuntu-20.04'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.include.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies (ubuntu only)
if: matrix.include.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ (matrix.include.platform == 'macos-latest'&&'aarch64-apple-darwin') || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Sync Pnpm version
uses: pnpm/action-setup@v2
with:
version: 6.32.9
- name: Sync node version and setup cache
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
- name: Install app dependencies and build web
run: pnpm install
- name: Build the app
uses: tauri-apps/tauri-action@v0.4
env:
GITHUB_TOKEN: ${{ secrets.LETTURA_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD : ${{ secrets.TAURI_KEY_PASSWORD }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
publish-release:
permissions:
contents: write
runs-on: ubuntu-20.04
needs: [create-release, build]
steps:
- name: publish release
id: publish-release
uses: actions/github-script@v6
env:
release_id: ${{ needs.create-release.outputs.release_id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: false,
prerelease: false,
args: ${{ matrix.include.args }}
})
# update_json:
# needs: release
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v3
# - name: Set Node.js Env
# uses: actions/setup-node@v3
# with:
# node-version: 'lts/*'
# - name: Create file
# working-directory: ./
# env:
# GITHUB_TOKEN: ${{ secrets.LETTURA_TOKEN }}
# run: |
# node ./scripts/updater.mjs --info ${{ needs.release.outputs }}