From 77b5c734b5e417050dfbbdf296f4aed2ed5f31c8 Mon Sep 17 00:00:00 2001 From: Akulij Date: Mon, 5 May 2025 19:50:49 +0300 Subject: [PATCH] cd.yaml: build project --- .gitea/workflows/cd.yaml | 47 ++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml index 2816974..d2b81a0 100644 --- a/.gitea/workflows/cd.yaml +++ b/.gitea/workflows/cd.yaml @@ -1,17 +1,40 @@ -name: Gitea Actions Demo -run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +name: Build && Deploy on: [push] jobs: - Explore-Gitea-Actions: + build: + name: cargo build runs-on: ubuntu-latest steps: - - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ gitea.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." + - uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: 1.24 + + - name: Restore cached build dependencies + id: cache-project-dependencies + uses: actions/cache/restore@v4 + with: + path: | + ~/.cache/go-build + key: linux-project-dependencies + - run: go env -w CGO_ENABLED=1 + - env: + GOCACHE: ~/.cache/go-build + run: RUN --mount=type=cache,target="~/.cache/go-build" go build -o app ./cmd/app + + - name: Save cached build dependencies + id: cache-project-dependencies-restore + uses: actions/cache/save@v4 + with: + path: | + ~/.cache/go-build + key: ${{ steps.cache-project-dependencies.outputs.cache-primary-key }} + + - name: Upload Release Binary + id: bot-artifact + uses: christopherhx/gitea-upload-artifact@v4 + with: + name: botrunner + path: app