forked from openyurtio/openyurt
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add yurtadm binaries release workflow
- Loading branch information
1 parent
211cb4f
commit 90cf7aa
Showing
3 changed files
with
140 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
schedule: | ||
# run at UTC 1:30 every day | ||
- cron: '30 1 * * *' | ||
workflow_dispatch: {} | ||
|
||
env: | ||
ALI_REGISTRY: registry.cn-hangzhou.aliyuncs.com/openyurt | ||
|
||
jobs: | ||
docker-push: | ||
if: github.repository == 'openyurtio/openyurt' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Get the version | ||
id: get_version | ||
run: | | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then | ||
VERSION=latest | ||
fi | ||
echo ::set-output name=VERSION::${VERSION} | ||
- name: Install Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Release | ||
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-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Get the version | ||
id: get_version | ||
run: | | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then | ||
VERSION=latest | ||
fi | ||
echo ::set-output name=VERSION::${VERSION} | ||
- name: Install Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.ALI_REGISTRY }} | ||
username: ${{ secrets.ALI_REGISTRY_USERNAME }} | ||
password: ${{ secrets.ALI_REGISTRY_PASSWORD }} | ||
- name: Release | ||
run: make docker-push TARGET_PLATFORMS=linux/amd64,linux/arm64,linux/arm/v7 IMAGE_REPO=${{ env.ALI_REGISTRY }} IMAGE_TAG=${{ steps.get_version.outputs.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,42 @@ | ||
name: Release | ||
name: Release-Assets | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
schedule: | ||
# run at UTC 1:30 every day | ||
- cron: '30 1 * * *' | ||
workflow_dispatch: {} | ||
|
||
env: | ||
ALI_REGISTRY: registry.cn-hangzhou.aliyuncs.com/openyurt | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
docker-push: | ||
if: github.repository == 'openyurtio/openyurt' | ||
goreleaser: | ||
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: | ||
submodules: true | ||
- name: Get the version | ||
id: get_version | ||
run: | | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then | ||
VERSION=latest | ||
fi | ||
echo ::set-output name=VERSION::${VERSION} | ||
- name: Install Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Release | ||
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-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- name: Get the version | ||
id: get_version | ||
run: | | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then | ||
VERSION=latest | ||
fi | ||
echo ::set-output name=VERSION::${VERSION} | ||
- name: Install Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
go-version: 1.18 | ||
cache: true | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
registry: ${{ env.ALI_REGISTRY }} | ||
username: ${{ secrets.ALI_REGISTRY_USERNAME }} | ||
password: ${{ secrets.ALI_REGISTRY_PASSWORD }} | ||
- name: Release | ||
run: make docker-push TARGET_PLATFORMS=linux/amd64,linux/arm64,linux/arm/v7 IMAGE_REPO=${{ env.ALI_REGISTRY }} IMAGE_TAG=${{ steps.get_version.outputs.VERSION }} | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |