.github/workflows/desktop-release-linux.yml
name: Release Linux App
on:
release:
paths:
- 'desktop/**'
types: [ published ]
jobs:
release:
defaults:
run:
working-directory: desktop
name: Release Linux App
runs-on: ubuntu-22.04
strategy:
matrix:
platform:
- linux/amd64
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Normalise platform tag
id: normalise_platform
shell: bash
run: |
tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g')
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Normalise version tag
id: normalise_version
shell: bash
run: |
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Install wails
shell: bash
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Install Ubuntu prerequisites
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Build frontend assets
shell: bash
run: |
npm install -g npm@10
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
mv tmp.json wails.json
cd frontend
jq '.version = "${{ steps.normalise_version.outputs.version }}"' package.json > tmp.json
mv tmp.json package.json
npm install
- name: Build wails app for Linux
shell: bash
run: |
./frontend/node_modules/typescript/bin/tsc -v
CGO_ENABLED=1 wails build -platform ${{ matrix.platform }} \
-ldflags "-X main.version=${{ github.event.release.tag_name }}" \
-o penny
- name: Upload release asset
shell: bash
working-directory: ./desktop/build/bin/
run: |
filepath="penny"
filename="penny_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}"
upload_url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets"
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/octet-stream" --data-binary @$filepath "$upload_url?name=$filename"