focus/.gitea/workflows/release.yaml

188 lines
5.2 KiB
YAML
Raw Normal View History

2024-01-13 22:47:31 +01:00
name: Build releases
run-name: ${{ gitea.actor }} is runs ci pipeline
on:
push:
tags:
- "v*"
jobs:
build-docker:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
strategy:
matrix:
include:
- context: ./backend
image: focus-backend
- context: ./frontend
dockerfile: ./frontend/Dockerfile
image: focus-frontend
- context: .
2024-01-14 13:49:03 +01:00
image: focus
2024-01-13 22:47:31 +01:00
env:
RUNNER_TOOL_CACHE: /toolcaches
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract tag
uses: olegtarasov/get-tag@v2.1.2
id: tagName
with:
tagRegex: "v(.*)"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
config-inline: |
[registry."git.bhasher.com"]
http = true
insecure = true
- name: Login
uses: docker/login-action@v2
with:
registry: git.bhasher.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push ${{ matrix.image }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
file: ${{ matrix.context }}/Dockerfile
push: true
platforms: |
linux/amd64
linux/arm64
tags: |
git.bhasher.com/bhasher/${{ matrix.image }}:latest
git.bhasher.com/bhasher/${{ matrix.image }}:${{ steps.tagName.outputs.tag }}
build-tauri:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
env:
RUNNER_TOOL_CACHE: /toolcache
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract tag
uses: olegtarasov/get-tag@v2.1.2
id: tagName
with:
tagRegex: "v(.*)"
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libgtk-3-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: |
cd frontend
npm install
cd ..
- name: Build desktop app
run: |
cd frontend
npm run tauri build
cd ..
- name: Publish desktop app
uses: akkuman/gitea-release-action@v1
with:
name: Focus ${{ steps.tagName.outputs.tag }}
prerelease: true
files: |-
2024-01-14 13:49:03 +01:00
frontend/src-tauri/target/release/focus-desktop
2024-01-13 22:47:31 +01:00
frontend/src-tauri/target/release/bundle/deb/*.deb
frontend/src-tauri/target/release/bundle/appimage/*.AppImage
2024-01-14 13:49:03 +01:00
- name: Generate sha256sum
run: |
mkdir -p ./ci/pkgbuild/desktop-bin
sha256sum frontend/src-tauri/target/release/bundle/deb/*.deb | cut -d" " -f 1 > ./ci/pkgbuild/desktop-bin/sha256sum
- name: Generate PKGBUILD
env:
RELEASE_TAG: ${{ steps.tagName.outputs.tag }}
run: ./ci/generate-pkgbuild-desktop.py
- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2.7.0
with:
pkgname: focus-desktop-bin
pkgbuild: ./ci/pkgbuild/desktop-bin/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_KEY }}
commit_message: Update focus-desktop-bin to ${{ steps.tagName.outputs.tag }}
build-server:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
env:
RUNNER_TOOL_CACHE: /toolcache
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract tag
uses: olegtarasov/get-tag@v2.1.2
id: tagName
with:
tagRegex: "v(.*)"
- name: Set up go
uses: actions/setup-go@v3
with:
go-version: 1.21.5
- name: Build server
run: |
cd backend
go build -o focus-server .
cd ..
- name: Publish server
uses: akkuman/gitea-release-action@v1
with:
name: Focus ${{ steps.tagName.outputs.tag }}
prerelease: true
files: |-
backend/focus-server
- name: Generate sha256sum
run: |
mkdir -p ./ci/pkgbuild/server-bin
sha256sum backend/focus-server | cut -d" " -f 1 > ./ci/pkgbuild/server-bin/sha256sum
- name: Generate PKGBUILD
env:
RELEASE_TAG: ${{ steps.tagName.outputs.tag }}
run: ./ci/generate-pkgbuild-server.py
- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2.7.0
with:
pkgname: focus-server-bin
pkgbuild: ./ci/pkgbuild/server-bin/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_KEY }}
commit_message: Update focus-server-bin to ${{ steps.tagName.outputs.tag }}