re-add repo specific gitignores #75
Workflow file for this run
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 | |
on: | |
push: | |
tags: | |
- "*.*.*" | |
workflow_dispatch: | |
jobs: | |
check-runner: | |
runs-on: ubuntu-latest | |
outputs: | |
runner-label: ${{ steps.set-runner.outputs.runner-label }} | |
steps: | |
- name: Set runner | |
id: set-runner | |
run: | | |
runners=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.REPO_ACCESS_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runners") | |
available=$(echo "$runners" | jq '.runners[] | select(.status == "online" and .busy == false and .labels[] .name == "self-hosted")') | |
if [ -n "$available" ]; then | |
echo "runner-label=self-hosted" >> "$GITHUB_OUTPUT" | |
else | |
echo "runner-label=ubuntu-latest" >> "$GITHUB_OUTPUT" | |
fi | |
goreleaser: | |
needs: check-runner | |
runs-on: ${{ needs.check-runner.outputs.runner-label }} | |
steps: | |
# pull code | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# install latest node | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
# build sveltekit frontend | |
- name: Build frontend | |
run: | | |
npm i -g pnpm | |
pnpm --prefix=./frontend i | |
PUBLIC_VERSION=${GITHUB_REF##*/} pnpm --prefix=./frontend run build | |
cp -r ./frontend/build/* ./backend/pb_public/ | |
git reset --hard | |
# setup go | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "./backend/go.mod" | |
cache-dependency-path: "./backend/go.sum" | |
# build | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: "~> v2" | |
args: release --clean | |
workdir: backend | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AUR_KEY: ${{ secrets.AUR_KEY }} | |
docker: | |
needs: | |
- goreleaser | |
- check-runner | |
runs-on: ${{ needs.check-runner.outputs.runner-label }} | |
steps: | |
# pull code | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
# image tags | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/seriousm4x/UpSnap | |
seriousm4x/UpSnap | |
tags: | | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}} | |
type=semver,pattern={{major}}.{{minor}} | |
# qemu | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# docker buildx | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
# ghcr.io login | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# ducker hub login | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# build and push | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
build-args: | | |
VERSION=${{github.ref_name}} |