2022-02-01 14:51:25 +01:00
|
|
|
name: build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-12-29 15:05:12 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-02-01 14:51:25 +01:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
2024-06-05 03:19:31 +00:00
|
|
|
uses: actions/setup-go@v5.0.1
|
2022-02-01 14:51:25 +01:00
|
|
|
with:
|
2024-06-06 19:47:31 +02:00
|
|
|
go-version: "1.22"
|
2022-02-01 14:51:25 +01:00
|
|
|
|
|
|
|
- name: Set up nodejs
|
2023-12-27 21:43:19 +00:00
|
|
|
uses: actions/setup-node@v4
|
2022-02-01 14:51:25 +01:00
|
|
|
with:
|
|
|
|
node-version: '17'
|
2022-02-01 14:53:18 +01:00
|
|
|
|
|
|
|
- name: Create frontend bundle
|
2022-02-01 14:51:25 +01:00
|
|
|
run: cd public && npm ci && npm run bundle
|
|
|
|
|
|
|
|
- name: Cache Go modules
|
2024-01-17 17:19:45 +00:00
|
|
|
uses: actions/cache@v4
|
2022-02-01 14:51:25 +01:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
|
|
|
- name: Tests
|
|
|
|
run: |
|
2022-02-01 15:47:34 +01:00
|
|
|
go test ./...
|
2022-02-01 14:51:25 +01:00
|
|
|
|
2022-12-16 08:12:57 +01:00
|
|
|
# only on tags
|
2022-02-01 14:51:25 +01:00
|
|
|
- name: Run GoReleaser
|
2024-06-07 07:11:53 +00:00
|
|
|
uses: goreleaser/goreleaser-action@v6
|
2022-02-01 15:31:42 +01:00
|
|
|
if: success() && startsWith(github.ref, 'refs/tags/')
|
2022-02-01 14:51:25 +01:00
|
|
|
with:
|
|
|
|
version: latest
|
2024-06-06 19:47:31 +02:00
|
|
|
args: release --clean
|
2022-02-01 14:51:25 +01:00
|
|
|
env:
|
2022-02-01 15:34:00 +01:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|