Skip to content

Commit ec86989

Browse files
authored
feat: add automated releasing (#149)
1 parent d33e561 commit ec86989

File tree

6 files changed

+94
-30
lines changed

6 files changed

+94
-30
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
name: Build and release
1+
name: Build and release OCI image
22

33
on:
44
push:
5-
branches:
6-
- "main"
75
tags:
86
- "**"
97
pull_request:
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: go test & release
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
go-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/[email protected]
14+
15+
- uses: actions/setup-go@v3
16+
with:
17+
# renovate: go-version
18+
go-version: 1.18.2
19+
20+
- name: go test
21+
run: |
22+
go test -v ./... -race -covermode=atomic -coverprofile=coverage.out
23+
24+
- name: Upload coverage to Codecov
25+
uses: codecov/codecov-action@v3
26+
with:
27+
files: coverage.out
28+
29+
release:
30+
name: Release
31+
needs: go-test
32+
# We’re stull running in dry run, therefore don’t restrict to main yet
33+
# if: github.ref == 'refs/heads/main'
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v2
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Install GoReleaser
42+
uses: goreleaser/goreleaser-action@v2
43+
with:
44+
install-only: true
45+
46+
- name: Setup Node.js
47+
uses: actions/setup-node@v2
48+
with:
49+
node-version: "lts/*"
50+
51+
- name: Install dependencies
52+
run: npm install semantic-release @semantic-release/changelog @semantic-release/exec @semantic-release/git
53+
54+
- name: Release
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: npx -p @semantic-release/changelog -p @semantic-release/exec -p @semantic-release/git semantic-release

.github/workflows/go-test.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ tmp
22
gorm.db
33
coverage.out
44
/backend
5+
dist/

.goreleaser.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
builds:
2+
- env:
3+
- CGO_ENABLED=0
4+
goos:
5+
- linux
6+
- windows
7+
- darwin
8+
archives:
9+
- replacements:
10+
darwin: Darwin
11+
linux: Linux
12+
windows: Windows
13+
386: i386
14+
amd64: x86_64
15+
checksum:
16+
name_template: "checksums.txt"
17+
snapshot:
18+
name_template: "{{ incpatch .Version }}-next"
19+
changelog:
20+
sort: asc
21+
filters:
22+
exclude:
23+
- "^docs:"
24+
- "^test:"

.releaserc.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
branches: main
2+
preset: angular
3+
plugins:
4+
- "@semantic-release/commit-analyzer"
5+
- "@semantic-release/release-notes-generator"
6+
- "@semantic-release/changelog"
7+
- "@semantic-release/git"
8+
- - "@semantic-release/exec"
9+
- publishCmd: |
10+
echo "${nextRelease.notes}" > /tmp/release-notes.md
11+
goreleaser release --release-notes /tmp/release-notes.md --rm-dist

0 commit comments

Comments
 (0)