Skip to content

Commit

Permalink
gh-action: releases-job
Browse files Browse the repository at this point in the history
Signed-off-by: yue9944882 <[email protected]>
  • Loading branch information
yue9944882 committed Dec 15, 2021
1 parent 7088704 commit 6c9de8d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/go-postsubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ jobs:
- name: push
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
docker push oamdev/cluster-gateway:latest
docker push oamdev/cluster-gateway:latest
docker push oamdev/cluster-gateway-addon-manager:latest
50 changes: 50 additions & 0 deletions .github/workflows/go-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: GoRelease

on:
push:
tags:
- 'v*.*.*'
env:
# Common versions
GO_VERSION: '1.16'
GO_REQUIRED_MIN_VERSION: ''
GOPATH: '/home/runner/work/oamdev/cluster-gateway/go'
GITHUB_REF: ${{ github.ref }}

defaults:
run:
working-directory: go/src/oamdev/cluster-gateway

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
with:
fetch-depth: 1
path: go/src/oamdev/cluster-gateway
- name: install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: images
run: make image
- name: get release version
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: get major release version
run: |
echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV
- name: push image
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
docker tag oamdev/cluster-gateway:latest oamdev/cluster-gateway:$RELEASE_VERSION
docker tag oamdev/cluster-gateway-addon-manager:latest oamdev/cluster-gateway-addon-manager:$RELEASE_VERSION
docker push oamdev/cluster-gateway:$RELEASE_VERSION
docker push oamdev/cluster-gateway-addon-manager:$RELEASE_VERSION
- name: publish release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6c9de8d

Please sign in to comment.