diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cabf07ade..b54347e43 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,143 +1,70 @@ -name: 'Publish' +name: 'publish' + on: push: branches: - release + +# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the 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 + publish-tauri: permissions: contents: write strategy: fail-fast: false matrix: - include: - - platform: 'macos-latest' + settings: + - platform: 'macos-latest' # for Arm based macs (M1 and above). args: '--target aarch64-apple-darwin' - - platform: 'macos-latest' + - platform: 'macos-latest' # for Intel based macs. args: '--target x86_64-apple-darwin' - - platform: 'macos-latest' + - platform: 'macos-latest' # for both Arm and Intel based Macs args: '--target universal-apple-darwin' - - platform: 'ubuntu-20.04' + - platform: 'ubuntu-20.04' # for Tauri v1 you could replace this with 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 + runs-on: ${{ matrix.settings.platform }} + steps: + - uses: actions/checkout@v4 - - name: Rust setup - uses: dtolnay/rust-toolchain@stable + - name: setup node + uses: actions/setup-node@v4 with: - targets: ${{ (matrix.include.platform == 'macos-latest'&&'aarch64-apple-darwin') || '' }} + node-version: lts/* - - name: Rust cache - uses: swatinem/rust-cache@v2 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable with: - workspaces: './src-tauri -> target' + # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. + targets: ${{ matrix.settings.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} - - 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 dependencies (ubuntu only) + if: matrix.settings.platform == 'ubuntu-20.04' # This must match the platform value defined above. + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + # webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. + # You can remove the one that doesn't apply to your app to speed up the workflow a bit. - - name: Install app dependencies and build web - run: pnpm install + - name: install frontend dependencies + run: pnpm install # change this to npm, pnpm or bun depending on which one you use. - - name: Build the app - uses: tauri-apps/tauri-action@v0.4 + - uses: tauri-apps/tauri-action@v0 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 }} + tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + releaseName: 'v__VERSION__' + releaseBody: 'See the assets to download this version and install.' + releaseDraft: true + prerelease: false + args: ${{ matrix.settings.args }}