From cb7a2fe39725fab983855c9c5115fb513e63dacb Mon Sep 17 00:00:00 2001 From: genofire Date: Thu, 18 Jul 2024 11:12:13 +0200 Subject: [PATCH] fix(ci): build and release binary --- .github/workflows/docs.yaml | 2 ++ .github/workflows/go.yml | 22 +++++++++++++++++++++- .github/workflows/release.yml | 13 ++++++++++--- .releaserc | 6 +++++- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 3163b5a7..fc496394 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -1,4 +1,5 @@ name: Docs + on: push: branches: @@ -6,6 +7,7 @@ on: permissions: contents: write + jobs: deploy: runs-on: ubuntu-latest diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c32b55d6..a0648b6d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,8 +1,9 @@ -name: Test, Lint +name: Golang on: push: pull_request: + release: jobs: test: @@ -64,3 +65,22 @@ jobs: version: latest skip-cache: true args: --timeout=5m + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-go@v2 + with: + go-version: '1.21' + - name: Build + run: go build -ldflags "-X github.com/FreifunkBremen/yanic/cmd.VERSION=$(git describe --tags)" -v + env: + CGO_ENABLED: 0 + - name: Archive build artifacts + uses: actions/upload-artifact@v2 + with: + name: build + path: yanic diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3b0e1d0..70ec9691 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,9 @@ - name: Release + on: workflow_run: workflows: - - "Test, Lint" - - "Docs" + - "Golang" types: [ "completed" ] branches: - main @@ -38,6 +37,14 @@ jobs: - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies run: npm audit signatures + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + pattern: build* + path: build/ + merge-multiple: true + run-id: ${{ github.event.workflow_run.id }} + - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.releaserc b/.releaserc index 4bb9e614..9b97b9c2 100644 --- a/.releaserc +++ b/.releaserc @@ -22,7 +22,11 @@ ], [ "@semantic-release/github", - {} + { + "assets": [ + { "path": "build/yanic*" } + ] + } ] ] }