fix(ci): build and release binary

This commit is contained in:
genofire 2024-07-18 11:12:13 +02:00
parent 9255831144
commit 99eebc8582
No known key found for this signature in database
GPG Key ID: FBF32CFFD052F863
4 changed files with 47 additions and 5 deletions

View File

@ -1,4 +1,5 @@
name: Docs name: Docs
on: on:
push: push:
branches: branches:
@ -6,6 +7,7 @@ on:
permissions: permissions:
contents: write contents: write
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -1,8 +1,9 @@
name: Test, Lint name: Golang
on: on:
push: push:
pull_request: pull_request:
release:
jobs: jobs:
test: test:
@ -64,3 +65,29 @@ jobs:
version: latest version: latest
skip-cache: true skip-cache: true
args: --timeout=5m args: --timeout=5m
build:
strategy:
matrix:
include:
- arch: amd64
os: linux
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 -o yanic_${{ matrix.arch }}_${{ matrix.os }}
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.arch }}-${{ matrix.os }}
path: yanic_*

View File

@ -1,10 +1,9 @@
name: Release name: Release
on: on:
workflow_run: workflow_run:
workflows: workflows:
- "Test, Lint" - "Golang"
- "Docs"
types: [ "completed" ] types: [ "completed" ]
branches: branches:
- main - main
@ -12,6 +11,7 @@ on:
permissions: permissions:
contents: read # for checkout contents: read # for checkout
attestations: read # for artifacts download
jobs: jobs:
release: release:
@ -38,6 +38,15 @@ jobs:
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures 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 }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Release - name: Release
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -22,7 +22,11 @@
], ],
[ [
"@semantic-release/github", "@semantic-release/github",
{} {
"assets": [
{ "path": "build/yanic*" }
]
}
] ]
] ]
} }