lazap-build #54
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: "lazap-build" | |
on: | |
workflow_dispatch: | |
env: | |
ARCH: x86_64 | |
DEPENDENCIES_ARCH: "'libappindicator-gtk3' 'webkit2gtk' 'gtk3' 'xdotool'" | |
DEPENDENCIES_RPM: "javascriptcoregtk4.0, webkit2gtk4.0, libxdo, libappindicator-gtk3, xdotool" | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
name: lazap | |
name_bin: lazap-bin | |
version: ${{ steps.get-package.outputs.version }} | |
description: "Lightweight cross-platform software, unifying games into a single, modern library" | |
license: "CC-BY-NC-SA-4.0" | |
deb_pkg_name: lazap_${{ steps.get-package.outputs.version }}_amd64.deb | |
deb_pkg_path: ./src-tauri/target/release/bundle/deb/ | |
deb_pkg_renamed: lazap-${{ steps.get-package.outputs.version }}-${{ env.ARCH }}.deb | |
arch_pkg_name: lazap-bin-${{ steps.get-package.outputs.version }}-1-${{ env.ARCH }}.pkg.tar.zst | |
rpm_pkg_name: RPMS/lazap-${{ steps.get-package.outputs.version }}-1.${{ env.ARCH }}.rpm | |
tag_name: v${{ steps.get-package.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: get package info | |
id: get-package | |
run: | | |
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
publish-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-latest' | |
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: 20 | |
- 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-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf | |
- name: install app dependencies and build front-end | |
run: yarn install && yarn build | |
env: | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }} | |
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }} | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }} | |
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }} | |
with: | |
tagName: v__VERSION__ | |
releaseName: "Release v__VERSION__" | |
releaseBody: "See the assets to download this version and install." | |
releaseDraft: true | |
prerelease: false | |
args: ${{ matrix.args }} | |
- name: copy deb package && create PKGBUILD file (ubuntu only) | |
if: matrix.platform == 'ubuntu-latest' | |
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-latest' | |
uses: 2m/[email protected] | |
with: | |
debug: true | |
target: pkgbuild | |
pkgname: ${{ needs.setup.outputs.name_bin }}/ | |
- name: copy deb package && create rpm.spec file (ubuntu only) | |
if: matrix.platform == 'ubuntu-latest' | |
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 }}/rpm.spec | |
Name: ${{ needs.setup.outputs.name }} | |
Version: ${{ needs.setup.outputs.version }} | |
BuildArch: ${{ env.ARCH }} | |
Release: 1 | |
Summary: ${{ needs.setup.outputs.description }} | |
Requires: ${{ env.DEPENDENCIES_RPM }} | |
License: ${{ needs.setup.outputs.license }} | |
Source0: ${{ needs.setup.outputs.deb_pkg_renamed }} | |
%description | |
${{ needs.setup.outputs.description }} | |
%prep | |
ar x %{SOURCE0} | |
%build | |
rm -rf control.tar.gz | |
tar xvf data.tar.gz | |
%install | |
cp -fr usr/ %{buildroot} | |
%files | |
%{_bindir}/${{ needs.setup.outputs.name }} | |
/usr/share/applications/${{ needs.setup.outputs.name }}.desktop | |
/usr/share/icons/hicolor/**/* | |
EOF | |
cat ${{ needs.setup.outputs.name_bin }}/rpm.spec | |
- name: createa rpm package (ubuntu only) | |
if: matrix.platform == 'ubuntu-latest' | |
uses: Antikythera/build-rpm@latest | |
with: | |
spec_file: ${{ needs.setup.outputs.name_bin }}/rpm.spec | |
sources: ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }} | |
- name: upload arch && rpm release (ubuntu only) | |
if: matrix.platform == 'ubuntu-latest' | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ needs.setup.outputs.tag_name }} | |
files: | | |
${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.arch_pkg_name }} | |
${{ needs.setup.outputs.rpm_pkg_name }} | |
${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_name }} |