Release alpha#26 #26
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: Release | |
run-name: Release ${{ github.ref_name }}#${{ github.run_number }} | |
on: | |
push: | |
branches: | |
- main | |
- alpha | |
- beta | |
- next | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
id-token: write | |
packages: write | |
jobs: | |
build-backend: | |
name: Build Backend | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
install: true | |
- name: Log in to the Container registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set tags for main branch | |
if: github.ref == 'refs/heads/main' | |
run: echo "TAGS=latest,main,main:${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV | |
- name: Set tags for other branches | |
if: github.ref != 'refs/heads/main' | |
run: echo "TAGS=${GITHUB_REF#refs/heads/},${GITHUB_REF#refs/heads/}:${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: ${{ env.TAGS }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Save Docker image tags | |
run: echo "${{ steps.meta.outputs.tags }}" > backend-image-tags.txt | |
- name: Upload Backend Image Tags | |
uses: actions/upload-artifact@v3 | |
with: | |
name: backend-image-tags | |
path: backend-image-tags.txt | |
build-frontend: | |
name: Build Frontend on ${{ matrix.platform }} | |
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-22.04' | |
args: '' | |
- platform: 'windows-latest' | |
args: '' | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
- 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-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
- name: Install frontend dependencies | |
run: cd frontend && pnpm install | |
- name: Build Tauri | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
projectPath: frontend | |
args: ${{ matrix.args }} | |
- name: Upload Frontend Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: frontend-artifact-${{ matrix.platform }} | |
path: frontend/src-tauri/target | |
release: | |
name: Create Release | |
needs: [ build-backend, build-frontend ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Download Backend Image Tags | |
uses: actions/download-artifact@v3 | |
with: | |
name: backend-image-tags | |
- name: Download Frontend Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: frontend-artifacts | |
- name: Prepare Release Notes | |
run: | | |
echo "Backend Docker Image Tags:" >> RELEASE_NOTES.md | |
cat backend-image-tags.txt >> RELEASE_NOTES.md | |
echo "" >> RELEASE_NOTES.md | |
echo "Frontend Artifacts:" >> RELEASE_NOTES.md | |
find frontend-artifacts -type f >> RELEASE_NOTES.md | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release |