From 4fa62de7942f1465b375dd44d70c4ef81559882a Mon Sep 17 00:00:00 2001 From: Matthew Knight Date: Mon, 16 Feb 2026 07:37:00 +0000 Subject: [PATCH] CI and Deployment (#1) Reviewed-on: https://git.ts.mattnite.net/mattnite/forgejo-tickets/pulls/1 --- .forgejo/workflows/ci.yaml | 36 ++++++++++++++++++++++++ .forgejo/workflows/deploy.yaml | 50 ++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .forgejo/workflows/ci.yaml create mode 100644 .forgejo/workflows/deploy.yaml diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml new file mode 100644 index 0000000..b1ba779 --- /dev/null +++ b/.forgejo/workflows/ci.yaml @@ -0,0 +1,36 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: debian-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Run tests + run: go test ./... + + build: + runs-on: debian-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Docker CLI + run: | + apt-get update && apt-get install -y curl + curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-27.5.1.tgz \ + | tar xz --strip-components=1 -C /usr/local/bin docker/docker + + - name: Build image + run: docker build -t forgejo-tickets:test . diff --git a/.forgejo/workflows/deploy.yaml b/.forgejo/workflows/deploy.yaml new file mode 100644 index 0000000..238b995 --- /dev/null +++ b/.forgejo/workflows/deploy.yaml @@ -0,0 +1,50 @@ +name: Deploy + +on: + push: + branches: [main] + +concurrency: + group: deploy-main + cancel-in-progress: false + +jobs: + deploy: + runs-on: debian-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Docker CLI + run: | + apt-get update && apt-get install -y curl + curl -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-27.5.1.tgz \ + | tar xz --strip-components=1 -C /usr/local/bin docker/docker + + - name: Wait for Docker + run: | + timeout=30 + elapsed=0 + while ! docker info >/dev/null 2>&1; do + [ $elapsed -ge $timeout ] && echo "Docker not ready" && exit 1 + sleep 2 + elapsed=$((elapsed + 2)) + done + + - name: Build image + run: | + IMAGE="registry.ts.mattnite.net/forgejo-tickets" + docker build -t "${IMAGE}:${GITHUB_SHA}" -t "${IMAGE}:latest" . + + - name: Push image + run: | + IMAGE="registry.ts.mattnite.net/forgejo-tickets" + docker push "${IMAGE}:${GITHUB_SHA}" + docker push "${IMAGE}:latest" + + - name: Update infra + uses: https://git.ts.mattnite.net/mattnite/infra/actions/update-image@main + with: + updates: | + forgejo-tickets ${{ github.sha }} tickets/tickets.hcl + forgejo_token: ${{ secrets.INFRA_API_TOKEN }}