Skip to content

build

build #49

Workflow file for this run

name: 'build'
on:
workflow_dispatch:
push:
tags:
- v**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
download-dbip:
runs-on: ubuntu-latest
steps:
- name: Download dbip database
run: wget -nv -O- "https://download.db-ip.com/free/dbip-country-lite-2023-09.mmdb.gz" | zcat > dbip.mmdb
- uses: actions/upload-artifact@v3
with:
name: dbip
path: "dbip.mmdb"
build-binaries:
needs: download-dbip
strategy:
fail-fast: false
matrix:
platform:
- os: ubuntu-latest
rust_target: x86_64-unknown-linux-gnu
- os: macos-latest
rust_target: x86_64-apple-darwin
- os: macos-latest
rust_target: aarch64-apple-darwin
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform.os }}
steps:
- name: Disable crlf
if: matrix.platform.os == 'windows-latest'
run: |
git config --global core.autocrlf input
- uses: actions/checkout@v3
# Download the previously uploaded artifacts
- uses: actions/download-artifact@v3
id: download
with:
name: dbip
path: src-tauri/
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: 'Setup Rust'
if: matrix.platform.rust_target == 'aarch64-apple-darwin'
run: rustup target add aarch64-apple-darwin
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.platform.rust_target }}
workspaces: |
src-tauri
- name: install dependencies (ubuntu only)
if: matrix.platform.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf libasound2-dev
- name: install npm packages
run: npm ci
- uses: qu1ck/action-tauri-build@5c69c9fdbb4231a738b4a668a2caddf6af45eab8
id: tauri_build
with:
target: ${{ matrix.platform.rust_target }}
- name: Git status and version
run: |
git status
git describe --tags --dirty --always
git diff
# The artifacts output can now be used to upload the artifacts
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform.rust_target }}
path: "${{ join(fromJSON(steps.tauri_build.outputs.artifacts), '\n') }}"
- name: pack webapp
if: matrix.platform.os == 'ubuntu-latest'
working-directory: dist
id: pack-webapp
run: |
GIT_VERSION=`git describe --tags --always`
zip -9 -r "trguing-web-$GIT_VERSION.zip" ./* -x create\* -x \*.map -x \*flag-icons\*
echo "ZIPFILE=trguing-web-$GIT_VERSION.zip" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
if: matrix.platform.os == 'ubuntu-latest'
with:
name: build web
path: "dist/${{ steps.pack-webapp.outputs.ZIPFILE }}"
publish:
needs: build-binaries
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
# Download the previously uploaded artifacts
- uses: actions/download-artifact@v3
id: download
with:
path: artifacts
- name: Rename mac app archives
run: |
mv artifacts/x86_64-apple-darwin/TrguiNG.app.tar.gz artifacts/x86_64-apple-darwin/TrguiNG_x86_64.app.tar.gz
mv artifacts/aarch64-apple-darwin/TrguiNG.app.tar.gz artifacts/aarch64-apple-darwin/TrguiNG_aarch64.app.tar.gz
- name: Downloaded artifacts
run: ls -lhR artifacts/
# Generate chagnelog
- id: prevtag
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo '')
echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
- name: Generate changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
if: steps.prevtag.outputs.previous_tag
with:
token: ${{ secrets.GITHUB_TOKEN }}
show-emoji: false
# And create a release with the artifacts attached
- name: 'create release'
uses: softprops/action-gh-release@v0.1.15
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
draft: true
files: ./artifacts/**/*
body: |
${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}