Merge pull request #14 from bovirus/master #648
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: "publish" | |
on: | |
workflow_dispatch: | |
push: | |
branches: [master] | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
ARCH: x86_64 | |
DEPENDENCIES_ARCH: "'libappindicator-gtk3' 'webkit2gtk-4.1' 'gtk3' 'xdotool'" | |
jobs: | |
setup: | |
runs-on: ubuntu-22.04 | |
outputs: | |
name: ${{ steps.get-package.outputs.name }} | |
name_bin: ${{ steps.get-package.outputs.name }}-bin | |
version: ${{ steps.get-package.outputs.version }} | |
description: ${{ steps.get-package.outputs.description }} | |
license: ${{ steps.get-package.outputs.license }} | |
deb_pkg_name: ${{ steps.get-package.outputs.name }}_${{ steps.get-package.outputs.version }}_amd64.deb | |
deb_pkg_path: ./src-tauri/target/release/bundle/deb/ | |
deb_pkg_renamed: ${{ steps.get-package.outputs.name }}-${{ steps.get-package.outputs.version }}-${{ env.ARCH }}.deb | |
arch_pkg_name: ${{ steps.get-package.outputs.name }}-bin-${{ steps.get-package.outputs.version }}-1-${{ env.ARCH }}.pkg.tar.zst | |
tag_name: v${{ steps.get-package.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: get package info | |
id: get-package | |
run: | | |
echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT | |
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
echo "description=$(node -p "require('./package.json').description")" >> $GITHUB_OUTPUT | |
echo "license=$(node -p "require('./package.json').license")" >> $GITHUB_OUTPUT | |
build-tauri: | |
needs: [setup] | |
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: "ubuntu-22.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: lts/* | |
- name: install rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- name: install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libayatana-appindicator3-dev libxdo3 libxdo-dev libwebkit2gtk-4.1-dev | |
- name: install frontend dependencies | |
run: yarn install | |
- name: Set NO_STRIP environment variable | |
if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'macos-latest' | |
run: echo "NO_STRIP=true" >> $GITHUB_ENV | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tagName: ${{ needs.setup.outputs.tag_name }} | |
releaseName: ${{ needs.setup.outputs.tag_name }} | |
releaseDraft: false | |
prerelease: false | |
- name: copy deb package && create PKGBUILD file (ubuntu only) | |
if: matrix.platform == 'ubuntu-22.04' | |
run: | | |
mkdir -p ${{ needs.setup.outputs.name_bin }} | |
cp -fr ${{ needs.setup.outputs.deb_pkg_path }}${{ needs.setup.outputs.deb_pkg_name }} ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }} | |
cat <<EOF > ./${{ needs.setup.outputs.name_bin }}/PKGBUILD | |
pkgname=${{ needs.setup.outputs.name_bin }} | |
pkgver=${{ needs.setup.outputs.version }} | |
md5sums=('$(md5sum ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }} | awk '{print $1}')') | |
pkgrel=1 | |
depends=(${{ env.DEPENDENCIES_ARCH }}) | |
pkgdesc='${{ needs.setup.outputs.description }}' | |
arch=('${{ env.ARCH }}') | |
url="https://github.com/${{ github.repository }}" | |
license=('${{ needs.setup.outputs.license }}') | |
source=("\$url/releases/download/${{ needs.setup.outputs.tag_name }}/${{ needs.setup.outputs.deb_pkg_renamed }}") | |
build() { | |
rm control.tar.gz | |
tar xvf data.tar.gz | |
} | |
package() { | |
cp -fr usr/ \${pkgdir} | |
} | |
EOF | |
cat ${{ needs.setup.outputs.name_bin }}/PKGBUILD | |
- name: create arch package (ubuntu only) | |
if: matrix.platform == 'ubuntu-22.04' | |
uses: 2m/[email protected] | |
with: | |
debug: true | |
target: pkgbuild | |
pkgname: ${{ needs.setup.outputs.name_bin }}/ | |
- name: upload arch && rpm release (ubuntu only) | |
if: matrix.platform == 'ubuntu-22.04' | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ needs.setup.outputs.tag_name }} | |
files: | | |
${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.arch_pkg_name }} |