-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (73 loc) · 2.07 KB
/
build-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# ref: https://dev.to/cloudx/multi-arch-docker-images-the-easy-way-with-github-actions-4k54
name: Docker
# Controls when the workflow will run
on:
push:
branches:
- 'main'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
env:
flags: ""
steps:
- if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "flags=--snapshot" >> $GITHUB_ENV
# Get the repository's code
- name: Checkout
uses: actions/checkout@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: "1.20"
cache: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: "frontend/yarn.lock"
- name: Install dependencies
run: |
yarn --frozen-lockfile
working-directory: frontend
- name: Build frontend
run: |
yarn build
working-directory: frontend
- name: Run goreleaser build
if: github.event_name == 'pull_request'
uses: goreleaser/goreleaser-action@v4
with:
args: build --snapshot --single-target
- name: Run goreleaser release
if: github.event_name != 'pull_request'
uses: goreleaser/goreleaser-action@v4
with:
args: release ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}