From 606a4b25efdd58fbaad1a177485b618d6fa558f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20Sz=C5=91ke?= Date: Wed, 27 Mar 2024 13:41:40 +0100 Subject: [PATCH] fix: release publishes hopefully --- .github/workflows/publish.yml | 114 ---------------------------------- .github/workflows/release.yml | 94 ++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 114 deletions(-) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index b4711dc..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Publish - -on: - push: - branches: - - main - tags: - - '*' - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: write - -jobs: - upload_license: - name: Upload License - if: ${{ github.ref_type == 'tag' }} - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 - - - uses: actions/upload-artifact@v4 - with: - name: LICENSE - path: LICENSE - - build: - name: Build - ${{ matrix.platform }} - if: ${{ github.ref_type == 'tag' }} - runs-on: ${{ matrix.platform }} - strategy: - matrix: - platform: [macos-latest, windows-latest, ubuntu-20.04] - - steps: - - uses: actions/checkout@v4 - - - uses: Swatinem/rust-cache@v2 - with: - shared-key: whooosh-${{ matrix.platform }} - workspaces: src-tauri - - - uses: volta-cli/action@v4 - - - uses: dtolnay/rust-toolchain@stable - - - if: matrix.platform == 'ubuntu-20.04' - uses: awalsh128/cache-apt-pkgs-action@latest - with: - packages: libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev - version: 1.0 - - - run: yarn install --immutable - - - run: yarn tauri build --ci - - - uses: actions/upload-artifact@v4 - with: - name: artifact-${{ matrix.platform }} - path: src-tauri/target/release/bundle - retention-days: 7 - - upload_to_release: - needs: [build, upload_license] - name: Publish binaries - runs-on: ubuntu-20.04 - if: ${{ github.ref_type == 'tag' }} - steps: - - uses: actions/download-artifact@v4 - - - run: ls -R - - - name: Copy artifacts to archive - run: | - mv artifact-macos-latest macos - chmod +x -R macos - cp -r LICENSE/LICENSE macos/ - tar -czf macos.tar.gz macos/* - - mv artifact-windows-latest windows - chmod +x -R windows - cp -r LICENSE/LICENSE windows/ - tar -czf windows.tar.gz windows/* - - mv artifact-ubuntu-20.04 linux - chmod +x -R linux - cp -r LICENSE/LICENSE linux/ - tar -czf linux.tar.gz linux/* - - - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: macos.tar.gz - tag: ${{ github.ref }} - asset_name: macos-${{ github.ref_name }}.tar.gz - body: 'macos app and dmg' - - - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: windows.tar.gz - tag: ${{ github.ref }} - asset_name: windows-${{ github.ref_name }}.tar.gz - body: 'windows msi and exe' - - - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: linux.tar.gz - tag: ${{ github.ref }} - asset_name: linux-${{ github.ref_name }}.tar.gz - body: 'linux deb and appimage' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6bf85dc..b6220b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,3 +51,97 @@ jobs: with: body_path: GITHUB_CHANGELOG.md tag_name: ${{ steps.release.outputs.version }} + + build: + name: Build - ${{ matrix.platform }} + needs: [release] + runs-on: ${{ matrix.platform }} + strategy: + matrix: + platform: [macos-latest, windows-latest, ubuntu-20.04] + + steps: + - uses: actions/checkout@v4 + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: whooosh-${{ matrix.platform }} + workspaces: src-tauri + + - uses: volta-cli/action@v4 + + - uses: dtolnay/rust-toolchain@stable + + - if: matrix.platform == 'ubuntu-20.04' + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev + version: 1.0 + + - run: yarn install --immutable + + - run: yarn tauri build --ci + + - uses: actions/upload-artifact@v4 + with: + name: artifact-${{ matrix.platform }} + path: src-tauri/target/release/bundle + retention-days: 7 + + upload_to_release: + needs: [build] + name: Publish binaries + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - uses: WyriHaximus/github-action-get-previous-tag@v1.4.0 + id: get-latest-tag + + - uses: actions/download-artifact@v4 + + - run: ls -R + + - name: Copy artifacts to archive + run: | + mv artifact-macos-latest macos + chmod +x -R macos + cp -r LICENSE macos/LICENSE + tar -czf macos.tar.gz macos/* + + mv artifact-windows-latest windows + chmod +x -R windows + cp -r LICENSE windows/LICENSE + tar -czf windows.tar.gz windows/* + + mv artifact-ubuntu-20.04 linux + chmod +x -R linux + cp -r LICENSE linux/LICENSE + tar -czf linux.tar.gz linux/* + + - uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: macos.tar.gz + tag: ${{ steps.get-latest-tag.outputs.tag }} + asset_name: macos-${{ github.sha }}.tar.gz + body: 'macos app and dmg' + + - uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: windows.tar.gz + tag: ${{ steps.get-latest-tag.outputs.tag }} + asset_name: windows-${{ github.sha }}.tar.gz + body: 'windows msi and exe' + + - uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: linux.tar.gz + tag: ${{ steps.get-latest-tag.outputs.tag }} + asset_name: linux-${{ github.sha }}.tar.gz + body: 'linux deb and appimage'