-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (99 loc) · 2.82 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
name: Build release
on:
push:
tags:
- "v*.*.*"
jobs:
build:
name: go ${{ matrix.version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: [ stable ]
os: [ macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.version }}
- name: Build
run: go build -o bin/ -v ./...
- name: Test
run: go test -v ./...
- name: Compress
uses: a7ul/tar-action@v1.2.0
id: compress
with:
command: c
#cwd: bin
files: bin
outPath: echo-service-${{ runner.os }}.tar.gz
- name: Upload Distribution
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ runner.os }}
path: "*.tar.gz"
docker:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
images: |
afrouper/echo-service
ghcr.io/afrouper/echo-service
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release:
name: Create Release
runs-on: ubuntu-latest
needs: [ docker, build ]
permissions:
contents: write
steps:
- name: Download
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Infos
run: ls -al artifacts
- uses: ncipollo/release-action@v1
name: Create Release
with:
draft: false
generateReleaseNotes: true
makeLatest: true
artifacts: "artifacts/artifacts-Linux/*.tar.gz,artifacts/artifacts-macOS/*.tar.gz,artifacts/artifacts-Windows/*.tar.gz"