Skip to content

Commit af3cc36

Browse files
committed
add versioning and github actions
1 parent 4a2ed9c commit af3cc36

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
on:
2+
push:
3+
tags:
4+
- "*"
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}
9+
10+
jobs:
11+
build-go:
12+
permissions:
13+
contents: write
14+
packages: write
15+
name: release linux/amd64
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: ncipollo/release-action@v1
20+
- uses: wangyoucao577/go-release-action@v1
21+
with:
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
goos: linux
24+
goarch: amd64
25+
26+
build-and-push-image:
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: read
30+
packages: write
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v3
35+
36+
- name: Log in to the Container registry
37+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Extract metadata (tags, labels) for Docker
44+
id: meta
45+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
46+
with:
47+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
49+
- name: Build and push Docker image
50+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
51+
with:
52+
context: .
53+
push: true
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}

bumpver.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[bumpver]
2+
current_version = "2023.99"
3+
version_pattern = "YYYY.INC1"
4+
commit_message = "🎉 Release {new_version}"
5+
commit = true
6+
tag = true
7+
push = true
8+
9+
[bumpver.file_patterns]
10+
"pkg/version.go" = [
11+
'const VERSION = "{version}"',
12+
]
13+
"bumpver.toml" = [
14+
'current_version = "{version}"',
15+
]

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
)
77

88
func main() {
9+
log.Printf("Letter v.%v\n", pkg.VERSION)
10+
911
r := pkg.NewRouter()
1012
err := r.Run()
1113
if err != nil {

pkg/version.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package pkg
2+
3+
const VERSION = "2023.99"

0 commit comments

Comments
 (0)