Add Github actions release CI (#2505)
Co-authored-by: shaunak_deshmukh <shaunak@infracloud.io>
This commit is contained in:
co-authored by
shaunak_deshmukh
parent
63c1c25fda
commit
a3fde534e2
@@ -0,0 +1,66 @@
|
||||
name: Create Draft release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v1.**
|
||||
- v2.**
|
||||
|
||||
env:
|
||||
GO_VERSION: 1.18.1
|
||||
KIND_VERSION: v0.14.0
|
||||
KIND_NODE_IMAGE_TAG: v1.19.16
|
||||
|
||||
jobs:
|
||||
create-draft-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
|
||||
|
||||
- name: Install GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
with:
|
||||
install-only: true
|
||||
|
||||
|
||||
- name: Kind Clutser
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
with:
|
||||
image: kindest/node:${{ env.KIND_NODE_IMAGE_TAG }}
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
config: kind.yaml
|
||||
|
||||
- name: Generate CRDs
|
||||
run: make generate-crds
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Docker Login
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v3
|
||||
with:
|
||||
version: latest
|
||||
args: release
|
||||
env:
|
||||
GORELEASER_CURRENT_TAG: ${{ steps.get_version.outputs.VERSION }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
||||
|
||||
#ToDo - Verify and upload releases
|
||||
+3
-4
@@ -8,7 +8,6 @@ release:
|
||||
header: |
|
||||
Release Highlights: https://fission.io/docs/releases/{{ .Tag }}/
|
||||
Install Guide: https://fission.io/docs/installation/
|
||||
Full Changelog: https://github.com/fission/fission/blob/master/CHANGELOG.md
|
||||
extra_files:
|
||||
- glob: ./manifest/charts/*
|
||||
- glob: ./manifest/yamls/*
|
||||
@@ -27,9 +26,9 @@ builds:
|
||||
- -X github.com/fission/fission/pkg/info.BuildDate={{.Date}}
|
||||
- -X github.com/fission/fission/pkg/info.Version={{.Tag}}
|
||||
gcflags:
|
||||
- all=-trimpath={{.Env.PWD}}
|
||||
- all=-trimpath={{ if index .Env "GITHUB_WORKSPACE"}}{{ .Env.GITHUB_WORKSPACE }}{{ else }}{{ .Env.PWD }}{{ end }}
|
||||
asmflags:
|
||||
- all=-trimpath={{.Env.PWD}}
|
||||
- all=-trimpath={{ if index .Env "GITHUB_WORKSPACE"}}{{ .Env.GITHUB_WORKSPACE }}{{ else }}{{ .Env.PWD }}{{ end }}
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
@@ -258,7 +257,7 @@ docker_manifests:
|
||||
- fission/reporter:latest-arm64
|
||||
- fission/reporter:latest-armv7
|
||||
changelog:
|
||||
skip: true
|
||||
skip: false
|
||||
archives:
|
||||
- id: fission
|
||||
builds:
|
||||
|
||||
+6
-2
@@ -39,14 +39,17 @@ check_clean() {
|
||||
}
|
||||
|
||||
check_github_token() {
|
||||
if [ ! -f "$HOME"/.github-token ]; then
|
||||
echo "Error finding github access token at ${HOME}/.github-token"
|
||||
if [ ! -f "$HOME"/.github-token ] && [ -z "$GITHUB_TOKEN" ]; then
|
||||
echo "Error finding github access token at ${HOME}/.github-token or in GITHUB_TOKEN envvar"
|
||||
exit 1
|
||||
fi
|
||||
echo "check_github_token == PASSED"
|
||||
}
|
||||
|
||||
# Read token from file if not set as envvar
|
||||
if [ -z "$GITHUB_TOKEN"]; then
|
||||
export GITHUB_TOKEN=$(cat ~/.github-token)
|
||||
fi
|
||||
|
||||
version=$1
|
||||
if [ -z "$version" ]; then
|
||||
@@ -66,6 +69,7 @@ check_github_token
|
||||
|
||||
export GORELEASER_CURRENT_TAG=$version
|
||||
echo "Release version $GORELEASER_CURRENT_TAG "
|
||||
echo "DOCKER_CLI_EXPERIMENTAL $DOCKER_CLI_EXPERIMENTAL"
|
||||
goreleaser release
|
||||
|
||||
echo "############ DONE #############"
|
||||
|
||||
Reference in New Issue
Block a user