From a5c7a5fea7bc39eeb7be26e802c7f06c6d5f5b37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Sun, 8 Dec 2024 12:22:35 +0100 Subject: [PATCH] Release pipeline --- .gitea/workflows/build.yml | 47 ++++++++++++++++++++++++++++++++++++++ .gitea/workflows/test.yml | 2 +- Taskfile.yml | 7 ++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..bbd6145 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,47 @@ + +name: Build and release + +on: + release: + types: [published] + # workflow_dispatch: + # inputs: + # version: + # description: 'Version' + # required: true + # default: 'v0' + +jobs: + test: + runs-on: [moon, amd64] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + # - name: Install dependencies + # run: | + # sudo apt-get update + # sudo apt-get install -y task + + - name: Run tests + run: task test + + - name: Build + run: | + task build VERSION=${{ github.ref_name }} + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./lobby2-${{ github.ref_name }}-amd64 + asset_name: lobby2-${{ github.ref_name }}-amd64 + asset_content_type: application/octet-stream diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 3dec1ca..5ab80c6 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test Project +name: Tests on: push: diff --git a/Taskfile.yml b/Taskfile.yml index 7a7dea0..c5ee84f 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,6 +2,9 @@ version: '3' +vars: + VERSION: 0.0.0 + tasks: docs: cmds: @@ -12,3 +15,7 @@ tasks: - go mod tidy - go test -v ./... silent: false + build: + cmds: + - go mod tidy + - go build -o lobby2-{{ .VERSION }}-amd64 cli/*.go