Skip to content

Commit 9d5c451

Browse files
author
rambohe
authored
feat: add yurtadm binaries release workflow (#1601)
1 parent 8b9a05e commit 9d5c451

File tree

4 files changed

+95
-6
lines changed

4 files changed

+95
-6
lines changed

.github/workflows/ci.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ env:
2323
jobs:
2424

2525
verify:
26-
runs-on: ubuntu-18.04
26+
runs-on: ubuntu-22.04
2727
steps:
2828
- name: Checkout
2929
uses: actions/checkout@v2
3030
- name: Verify Code
3131
run: make verify
3232

3333
golangci-lint:
34-
runs-on: ubuntu-18.04
34+
runs-on: ubuntu-22.04
3535
steps:
3636
- name: Checkout
3737
uses: actions/checkout@v2
@@ -48,7 +48,7 @@ jobs:
4848
args: -v
4949

5050
markdownlint-misspell-shellcheck:
51-
runs-on: ubuntu-18.04
51+
runs-on: ubuntu-22.04
5252
# this image is build from Dockerfile
5353
# https://github.com/pouchcontainer/pouchlinter/blob/master/Dockerfile
5454
container: pouchcontainer/pouchlinter:v0.1.2
@@ -73,7 +73,7 @@ jobs:
7373
# bash -c "exit $code";
7474

7575
unit-tests:
76-
runs-on: ubuntu-18.04
76+
runs-on: ubuntu-22.04
7777
steps:
7878
- uses: actions/checkout@v2
7979
with:
@@ -104,7 +104,7 @@ jobs:
104104
fail_ci_if_error: true
105105
verbose: true
106106
e2e-tests:
107-
runs-on: ubuntu-18.04
107+
runs-on: ubuntu-22.04
108108
steps:
109109
- uses: actions/checkout@v2
110110
with:

.github/workflows/release.yaml .github/workflows/registry.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Release Images
22

33
on:
44
push:

.github/workflows/release-assets.yaml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release Assets
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch: {}
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
goreleaser:
14+
if: github.repository == 'openyurtio/openyurt'
15+
permissions:
16+
contents: write
17+
actions: read
18+
checks: write
19+
issues: read
20+
packages: write
21+
pull-requests: read
22+
repository-projects: read
23+
statuses: read
24+
runs-on: ubuntu-22.04
25+
name: goreleaser
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
with:
30+
fetch-depth: 0
31+
- name: Set up Go
32+
uses: actions/setup-go@v4
33+
with:
34+
go-version: 1.18
35+
cache: true
36+
- name: Run GoReleaser
37+
uses: goreleaser/goreleaser-action@v4
38+
with:
39+
distribution: goreleaser
40+
version: latest
41+
args: release --clean
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
builds:
4+
- id: yurtadm
5+
binary: yurtadm
6+
goos:
7+
- linux
8+
- darwin
9+
goarch:
10+
- amd64
11+
- arm64
12+
main: ./cmd/yurtadm/yurtadm.go
13+
ldflags:
14+
- -s -w -X github.com/openyurtio/openyurt/pkg/projectinfo.gitVersion={{ .Tag }} -X github.com/openyurtio/openyurt/pkg/projectinfo.gitCommit={{ .ShortCommit }} -X github.com/openyurtio/openyurt/pkg/projectinfo.buildDate={{ .Date }}
15+
env:
16+
- CGO_ENABLED=0
17+
18+
archives:
19+
- format: tar.gz
20+
id: yurtadm-tgz
21+
wrap_in_directory: '{{ .Os }}-{{ .Arch }}'
22+
builds:
23+
- yurtadm
24+
name_template: '{{ .ArtifactName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}'
25+
files: [ LICENSE, README.md ]
26+
- format: zip
27+
id: yurtadm-zip
28+
builds:
29+
- yurtadm
30+
wrap_in_directory: '{{ .Os }}-{{ .Arch }}'
31+
name_template: '{{ .ArtifactName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}'
32+
files: [ LICENSE, README.md ]
33+
34+
checksum:
35+
name_template: 'sha256sums.txt'
36+
changelog:
37+
sort: asc
38+
filters:
39+
exclude:
40+
- '^docs:'
41+
- '^test:'
42+
43+
# The lines beneath this are called `modelines`. See `:help modeline`
44+
# Feel free to remove those if you don't want/use them.
45+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
46+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

0 commit comments

Comments
 (0)