From f807cdd075cfdc0c53fa5ad8747969959e4ae08e Mon Sep 17 00:00:00 2001 From: V Date: Sat, 16 May 2026 21:39:08 +0100 Subject: [PATCH] Use image-only Gitea workflows --- .gitea/workflows/ci.yml | 15 ++++++++++++- .gitea/workflows/publish.yml | 42 +++++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index fc89229..56a3fbf 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -13,7 +13,20 @@ jobs: image: golang:1.24-bookworm steps: - name: Checkout - uses: actions/checkout@v4 + env: + TOKEN: ${{ github.token }} + run: | + set -eu + git init . + if [ -n "${TOKEN:-}" ]; then + server="${GITHUB_SERVER_URL#https://}" + server="${server#http://}" + git remote add origin "https://x-access-token:${TOKEN}@${server}/${GITHUB_REPOSITORY}.git" + else + git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" + fi + git fetch --depth=1 origin "${GITHUB_SHA}" + git checkout --detach FETCH_HEAD - name: Check formatting run: | diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml index 18e1a4a..689890f 100644 --- a/.gitea/workflows/publish.yml +++ b/.gitea/workflows/publish.yml @@ -6,14 +6,27 @@ on: - main jobs: - build-push: - name: Test, build, and push image + lint-test: + name: Lint and test runs-on: ubuntu-latest container: image: golang:1.24-bookworm steps: - name: Checkout - uses: actions/checkout@v4 + env: + TOKEN: ${{ github.token }} + run: | + set -eu + git init . + if [ -n "${TOKEN:-}" ]; then + server="${GITHUB_SERVER_URL#https://}" + server="${server#http://}" + git remote add origin "https://x-access-token:${TOKEN}@${server}/${GITHUB_REPOSITORY}.git" + else + git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" + fi + git fetch --depth=1 origin "${GITHUB_SHA}" + git checkout --detach FETCH_HEAD - name: Check formatting run: | @@ -30,6 +43,29 @@ jobs: - name: Test run: go test ./... + build-push: + name: Build and push image + runs-on: ubuntu-latest + needs: lint-test + container: + image: docker:27-git + steps: + - name: Checkout + env: + TOKEN: ${{ github.token }} + run: | + set -eu + git init . + if [ -n "${TOKEN:-}" ]; then + server="${GITHUB_SERVER_URL#https://}" + server="${server#http://}" + git remote add origin "https://x-access-token:${TOKEN}@${server}/${GITHUB_REPOSITORY}.git" + else + git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" + fi + git fetch --depth=1 origin "${GITHUB_SHA}" + git checkout --detach FETCH_HEAD + - name: Read version run: | version="$(tr -d '[:space:]' < VERSION)"