Bump dependencies #546
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: Build client | |
on: | |
push: | |
branches: | |
- '*' | |
paths: | |
- .github/workflows/build-client.yml | |
- client/** | |
- server/constants.json | |
# Keep this uncommented until we're ready to start releasing client on a tag | |
# tags: | |
# - 'v*' | |
workflow_dispatch: | |
env: | |
TOMATO_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || 'preview' }} | |
# Arch package should match this (nodejs-lts-hydrogen = v18 below) | |
NODE_VERSION: 18 | |
concurrency: | |
group: client-build-${github.ref_type}-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
name: Build ${{ matrix.title }} | |
strategy: | |
matrix: | |
include: | |
- | |
title: macOS | |
os: macos-11 | |
arch: universal | |
platform: darwin | |
out_path: "*.dmg" | |
filename_suffix: macos.dmg | |
- | |
title: Windows | |
os: windows-2022 | |
arch: x64 | |
platform: win32 | |
out_path: squirrel.windows/x64/*.exe | |
filename_suffix: windows.exe | |
- | |
title: Linux (amd64) | |
os: ubuntu-22.04 | |
arch: x64 | |
platform: linux | |
out_path: deb/x64/*.deb | |
filename_suffix: linux_amd64.deb | |
- | |
title: Linux (arm64) | |
os: ubuntu-22.04 | |
arch: arm64 | |
platform: linux | |
out_path: deb/arm64/*.deb | |
filename_suffix: linux_arm64.deb | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: # For rev number in TOMATO_VERSION_SUFFIX | |
fetch-depth: 0 | |
- | |
name: Set variables | |
shell: bash | |
run: | | |
echo "CLIENT_FILENAME=tomato-client-${{ env.TOMATO_VERSION }}-${{ matrix.filename_suffix }}" >> "$GITHUB_ENV" | |
if [ "$GITHUB_REF_TYPE" = tag ]; then | |
echo "TOMATO_VERSION_SUFFIX=" >> "$GITHUB_ENV" | |
else | |
echo "TOMATO_VERSION_SUFFIX=-r$(git rev-list --count HEAD).$(git rev-parse --short=8 HEAD)" >> "$GITHUB_ENV" | |
fi | |
- | |
name: Setup Node v18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- | |
# macOS: appears to fix https://github.com/electron/forge/issues/2807 | |
name: Setup Python 3.11 (macOS) | |
uses: actions/setup-python@v4 | |
if: matrix.platform == 'darwin' | |
with: | |
python-version: '3.11' | |
- | |
name: Build package | |
shell: bash | |
run: | | |
echo "Building Tomato for ${{ matrix.title }}" | |
cd client | |
if [ "${{ matrix.platform }}" = "win32" ]; then | |
npm config set script-shell $(which bash) | |
fi | |
npm clean-install | |
TOMATO_VERSION=${{ env.TOMATO_VERSION }}${{ env.TOMATO_VERSION_SUFFIX }} npm run build | |
npx electron-forge make --arch ${{ matrix.arch }} --platform ${{ matrix.platform }} | |
mkdir ../client-build-files | |
mv -v out/make/${{ matrix.out_path }} ../client-build-files/${{ env.CLIENT_FILENAME }} | |
if [ "${{ matrix.platform }}" = "linux" -a "${{ matrix.arch }}" = "x64" ]; then | |
mv -v out/make/*.AppImage ../client-build-files/${CLIENT_FILENAME%%.*}.AppImage | |
fi | |
- | |
name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: client-build-files | |
path: client-build-files | |
retention-days: 2 | |
build-linux-arch: | |
runs-on: ubuntu-22.04 | |
name: Build Arch Linux | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: # For rev number in TOMATO_VERSION_SUFFIX | |
fetch-depth: 0 | |
- | |
name: Set variables | |
shell: bash | |
run: | | |
echo "CLIENT_FILENAME=tomato-client-${{ env.TOMATO_VERSION }}-linux-x86_64.pkg.tar.zst" >> "$GITHUB_ENV" | |
if [ "$GITHUB_REF_TYPE" = tag ]; then | |
echo "TOMATO_VERSION_SUFFIX=" >> "$GITHUB_ENV" | |
else | |
echo "TOMATO_VERSION_SUFFIX=-r$(git rev-list --count HEAD).$(git rev-parse --short=8 HEAD)" >> "$GITHUB_ENV" | |
fi | |
- | |
name: Setup rootless Docker | |
uses: ScribeMD/[email protected] | |
- | |
name: Build package | |
shell: bash | |
# nodejs-lts-hydrogen = Node v18 | |
run: | | |
docker run --rm -v "$PWD:/build" -w /build/client/scripts/arch -e "TOMATO_VERSION=${{ env.TOMATO_VERSION }}${{ env.TOMATO_VERSION_SUFFIX }}" archlinux:base-devel \ | |
sh -c 'pacman -Syu --noconfirm nodejs-lts-hydrogen && env EUID=1 makepkg -s --noconfirm' | |
mv client/scripts/arch/*.pkg.tar.zst "${{ env.CLIENT_FILENAME }}" | |
- | |
name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: client-build-files | |
path: ${{ env.CLIENT_FILENAME }} | |
retention-days: 2 | |
tag: | |
runs-on: ubuntu-22.04 | |
name: Tag release | |
if: github.ref_type == 'tag' || github.ref_name == 'main' | |
needs: [build, build-linux-arch] | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: client-build-files | |
path: client-build-files | |
- | |
name: Remove old preview release | |
uses: dev-drprasad/[email protected] | |
if: github.ref_type != 'tag' | |
with: | |
delete_release: true | |
tag_name: preview-build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Wait for old preview release deletion | |
shell: bash | |
if: github.ref_type != 'tag' | |
run: | | |
sleep 30s | |
- | |
name: Tag and upload preview release | |
uses: ncipollo/release-action@v1 | |
if: github.ref_type != 'tag' | |
with: | |
artifacts: "./client-build-files/*" | |
name: 'Tomato Preview Build' | |
body: 'This development preview build may not be safe: use it at your own risk.' | |
tag: 'preview-build' | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Tag and upload release | |
uses: ncipollo/release-action@v1 | |
if: github.ref_type == 'tag' | |
with: | |
artifacts: "./client-build-files/*" | |
name: 'Tomato Release ${{ github.ref_name }}' | |
tag: ${{ github.ref_name }} | |
token: ${{ secrets.GITHUB_TOKEN }} |