-
Notifications
You must be signed in to change notification settings - Fork 49
124 lines (113 loc) · 3.51 KB
/
release.yaml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Reference from:
# https://goreleaser.com/ci/actions/
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
permissions:
contents: write
jobs:
# TODO: Remove the jobs temporarily, because it is almost over the free limit of Github Action
# Test:
# name: Unit Test
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Set up Go 1.19
# uses: actions/setup-go@v2
# with:
# go-version: 1.19
# - run: go build ./...
# - run: go vet ./...
# - name: Running go tests with coverage
# env:
# GO111MODULE: on
# run: make cover
# GolangLint:
# name: Golang Lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Set up Go 1.19
# uses: actions/setup-go@v2
# with:
# go-version: 1.19
# - name: golangci-lint
# uses: golangci/golangci-lint-action@v3
# with:
# # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# version: v1.52.2
# # Lints Pull Request commits with commitlint.
# #
# # Rules can be referenced:
# # https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional
# CommitLint:
# name: Commit Lint
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - uses: wagoid/commitlint-github-action@v5
# Release the artifacts, release note and images.
Release:
runs-on: ubuntu-latest
# needs: [Test, GolangLint, CommitLint]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check if on tag
run: |
if [[ "${GITHUB_REF#refs/tags/}" != "$GITHUB_REF" ]]; then
echo "Running on tag ${GITHUB_REF#refs/tags/}"
else
echo "Not running on a tag"
fi
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install npm packages and build UI
working-directory: ./ui
run: |
npm install
# Using 'CI=false' prevents build errors due to warnings.
# It bypasses the 'process.env.CI = true' setting in CI environments
# that treats warnings as errors, ensuring a successful build.
CI=false npm run build
- name: Release the karpor with GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}