bump deps #375
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: Debian/Ubuntu Linux | |
os: ubuntu-22.04 | |
arch: x64 | |
platform: linux | |
out_path: deb/x64/*.deb | |
filename_suffix: linux_amd64.deb | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
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=-$(git rev-parse --short=8 HEAD)" >> "$GITHUB_ENV" | |
fi | |
- | |
name: Setup Node v18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- | |
name: Build package | |
shell: bash | |
run: | | |
echo "Building Tomato for ${{ matrix.title }}" | |
cd client | |
if [ "${{ matrix.name }}" = "windows" ]; then | |
npm config set --location=project 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 }} | |
mv -v out/make/${{ matrix.out_path }} "../${{ env.CLIENT_FILENAME }}" | |
- | |
name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: client-build-files | |
path: ${{ env.CLIENT_FILENAME }} | |
retention-days: 2 | |
build-linux-arch: | |
runs-on: ubuntu-22.04 | |
name: Build Arch Linux | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
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=-$(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@v3 | |
- | |
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 }} |