forked from cloudflare/goflow
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (115 loc) · 4.42 KB
/
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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Create release
on:
workflow_dispatch:
jobs:
build:
name: Build Executables
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { go-version: 1.23, go-os: linux, go-arch: amd64 }
- { go-version: 1.23, go-os: linux, go-arch: 386 }
- { go-version: 1.23, go-os: linux, go-arch: arm64 }
- { go-version: 1.23, go-os: linux, go-arch: arm }
- { go-version: 1.23, go-os: linux, go-arch: loong64 }
- { go-version: 1.23, go-os: linux, go-arch: mips }
- { go-version: 1.23, go-os: linux, go-arch: mips64 }
- { go-version: 1.23, go-os: linux, go-arch: mips64le }
- { go-version: 1.23, go-os: linux, go-arch: mipsle }
- { go-version: 1.23, go-os: linux, go-arch: ppc64 }
- { go-version: 1.23, go-os: linux, go-arch: ppc64le }
- { go-version: 1.23, go-os: linux, go-arch: riscv64 }
- { go-version: 1.23, go-os: linux, go-arch: s390x }
- { go-version: 1.23, go-os: openbsd, go-arch: amd64 }
- { go-version: 1.23, go-os: openbsd, go-arch: 386 }
- { go-version: 1.23, go-os: openbsd, go-arch: arm64 }
- { go-version: 1.23, go-os: openbsd, go-arch: arm }
- { go-version: 1.23, go-os: openbsd, go-arch: ppc64 }
- { go-version: 1.23, go-os: freebsd, go-arch: amd64 }
- { go-version: 1.23, go-os: freebsd, go-arch: 386 }
- { go-version: 1.23, go-os: freebsd, go-arch: arm64 }
- { go-version: 1.23, go-os: freebsd, go-arch: arm }
- { go-version: 1.23, go-os: freebsd, go-arch: riscv64 }
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build binary
run: go build .
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.go-os }}
GOARCH: ${{ matrix.go-arch }}
- name: Upload workflow artifacts
uses: actions/upload-artifact@v4
with:
name: goflow-${{ matrix.go-os }}-${{ matrix.go-arch }}
path: goflow
release:
name: Release
needs: build
runs-on: ubuntu-latest
timeout-minutes: 1440
permissions:
actions: read
contents: write
packages: write
security-events: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v5
with:
preset: conventionalcommits
github-token: ${{ secrets.GITHUB_TOKEN }}
git-user-name: ${{ github.actor }}
git-user-email: ${{ github.actor }}@users.noreply.github.com
input-file: '.github/CHANGELOG.md'
output-file: '.github/CHANGELOG.md'
release-count: 10000
skip-on-empty: false
skip-version-file: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and export to Docker
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: ghcr.io/${{ github.repository }}:test
- name: Test Docker Image
run: |
docker run --rm ghcr.io/${{ github.repository }}:test --help
- name: Build and push Docker Image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
tags: ghcr.io/${{ github.repository }}:${{ steps.changelog.outputs.tag }}, ghcr.io/${{ github.repository }}:latest
push: true
- name: Download workflow artifacts
uses: actions/download-artifact@v4
with:
pattern: goflow-*
- name: Create Release
uses: softprops/action-gh-release@v2
if: ${{ steps.changelog.outputs.skipped == 'false' }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
token: ${{ secrets.GITHUB_TOKEN }}
files: goflow*/goflow*