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: |
|
header: |
|
||||||
Release Highlights: https://fission.io/docs/releases/{{ .Tag }}/
|
Release Highlights: https://fission.io/docs/releases/{{ .Tag }}/
|
||||||
Install Guide: https://fission.io/docs/installation/
|
Install Guide: https://fission.io/docs/installation/
|
||||||
Full Changelog: https://github.com/fission/fission/blob/master/CHANGELOG.md
|
|
||||||
extra_files:
|
extra_files:
|
||||||
- glob: ./manifest/charts/*
|
- glob: ./manifest/charts/*
|
||||||
- glob: ./manifest/yamls/*
|
- glob: ./manifest/yamls/*
|
||||||
@@ -27,9 +26,9 @@ builds:
|
|||||||
- -X github.com/fission/fission/pkg/info.BuildDate={{.Date}}
|
- -X github.com/fission/fission/pkg/info.BuildDate={{.Date}}
|
||||||
- -X github.com/fission/fission/pkg/info.Version={{.Tag}}
|
- -X github.com/fission/fission/pkg/info.Version={{.Tag}}
|
||||||
gcflags:
|
gcflags:
|
||||||
- all=-trimpath={{.Env.PWD}}
|
- all=-trimpath={{ if index .Env "GITHUB_WORKSPACE"}}{{ .Env.GITHUB_WORKSPACE }}{{ else }}{{ .Env.PWD }}{{ end }}
|
||||||
asmflags:
|
asmflags:
|
||||||
- all=-trimpath={{.Env.PWD}}
|
- all=-trimpath={{ if index .Env "GITHUB_WORKSPACE"}}{{ .Env.GITHUB_WORKSPACE }}{{ else }}{{ .Env.PWD }}{{ end }}
|
||||||
env:
|
env:
|
||||||
- CGO_ENABLED=0
|
- CGO_ENABLED=0
|
||||||
goos:
|
goos:
|
||||||
@@ -258,7 +257,7 @@ docker_manifests:
|
|||||||
- fission/reporter:latest-arm64
|
- fission/reporter:latest-arm64
|
||||||
- fission/reporter:latest-armv7
|
- fission/reporter:latest-armv7
|
||||||
changelog:
|
changelog:
|
||||||
skip: true
|
skip: false
|
||||||
archives:
|
archives:
|
||||||
- id: fission
|
- id: fission
|
||||||
builds:
|
builds:
|
||||||
|
|||||||
+7
-3
@@ -39,14 +39,17 @@ check_clean() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_github_token() {
|
check_github_token() {
|
||||||
if [ ! -f "$HOME"/.github-token ]; then
|
if [ ! -f "$HOME"/.github-token ] && [ -z "$GITHUB_TOKEN" ]; then
|
||||||
echo "Error finding github access token at ${HOME}/.github-token"
|
echo "Error finding github access token at ${HOME}/.github-token or in GITHUB_TOKEN envvar"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "check_github_token == PASSED"
|
echo "check_github_token == PASSED"
|
||||||
}
|
}
|
||||||
|
|
||||||
export GITHUB_TOKEN=$(cat ~/.github-token)
|
# Read token from file if not set as envvar
|
||||||
|
if [ -z "$GITHUB_TOKEN"]; then
|
||||||
|
export GITHUB_TOKEN=$(cat ~/.github-token)
|
||||||
|
fi
|
||||||
|
|
||||||
version=$1
|
version=$1
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
@@ -66,6 +69,7 @@ check_github_token
|
|||||||
|
|
||||||
export GORELEASER_CURRENT_TAG=$version
|
export GORELEASER_CURRENT_TAG=$version
|
||||||
echo "Release version $GORELEASER_CURRENT_TAG "
|
echo "Release version $GORELEASER_CURRENT_TAG "
|
||||||
|
echo "DOCKER_CLI_EXPERIMENTAL $DOCKER_CLI_EXPERIMENTAL"
|
||||||
goreleaser release
|
goreleaser release
|
||||||
|
|
||||||
echo "############ DONE #############"
|
echo "############ DONE #############"
|
||||||
|
|||||||
Reference in New Issue
Block a user