Skip to content

Commit

Permalink
feat: add yurtadm binaries release workflow (#1603)
Browse files Browse the repository at this point in the history
  • Loading branch information
rambohe-ch authored Jul 12, 2023
1 parent a4f83a8 commit f31495d
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 8 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ env:
jobs:

verify:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Verify Code
run: make verify

golangci-lint:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -48,7 +48,7 @@ jobs:
args: -v

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

unit-tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
fail_ci_if_error: true
verbose: true
e2e-tests:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: Release Images

on:
push:
Expand All @@ -15,7 +15,7 @@ env:
jobs:
docker-push:
if: github.repository == 'openyurtio/openyurt'
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -41,7 +41,7 @@ jobs:
run: make docker-push TARGET_PLATFORMS=linux/amd64,linux/arm64,linux/arm/v7 IMAGE_TAG=${{ steps.get_version.outputs.VERSION }}
docker-push-ali-registry:
if: github.repository == 'openyurtio/openyurt'
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/release-assets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release Assets

on:
push:
tags:
- "v*"
workflow_dispatch: {}

permissions:
contents: read

jobs:
goreleaser:
if: github.repository == 'openyurtio/openyurt'
permissions:
contents: write
actions: read
checks: write
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read
runs-on: ubuntu-22.04
name: goreleaser
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
builds:
- id: yurtadm
binary: yurtadm
goos:
- linux
- darwin
goarch:
- amd64
- arm64
main: ./cmd/yurtadm/yurtadm.go
ldflags:
- -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 }}
env:
- CGO_ENABLED=0

archives:
- format: tar.gz
id: yurtadm-tgz
wrap_in_directory: '{{ .Os }}-{{ .Arch }}'
builds:
- yurtadm
name_template: '{{ .ArtifactName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}'
files: [ LICENSE, README.md ]
- format: zip
id: yurtadm-zip
builds:
- yurtadm
wrap_in_directory: '{{ .Os }}-{{ .Arch }}'
name_template: '{{ .ArtifactName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}'
files: [ LICENSE, README.md ]

checksum:
name_template: 'sha256sums.txt'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

0 comments on commit f31495d

Please sign in to comment.