-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from digitalocean/varsha/new-release-workflow
Update release workflow
- Loading branch information
Showing
5 changed files
with
77 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,19 +1,40 @@ | ||
name: release | ||
on: | ||
release: | ||
types: [published, edited, prereleased] | ||
name: publish-release | ||
workflow_dispatch: | ||
# Inputs the workflow accepts. | ||
inputs: | ||
tag: | ||
# Friendly description to be shown in the UI instead of 'name' | ||
description: 'tag and release to create' | ||
# Input has to be provided for the workflow to run | ||
required: true | ||
env: | ||
GITHUB_ENV: ".env" | ||
jobs: | ||
generate: | ||
name: Create release-artifacts | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@master | ||
- name: Generate artifacts | ||
uses: skx/github-action-build@master | ||
- name: Upload artifacts | ||
uses: skx/github-action-publish-binaries@master | ||
- name: Install go | ||
uses: actions/setup-go@0caeaed6fd66a828038c2da3c0f662a42862658f | ||
with: | ||
go-version: ^1.17 | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f | ||
- name: Login to dockerhub to push the image | ||
run: echo "${{ secrets.DockerHubToken }}" | docker login --username ${DOCKER_USER} --password-stdin | ||
env: | ||
DOCKER_USER: ${{ secrets.DockerHubUser }} | ||
- name: run make release ${{ github.event.inputs.tag }} | ||
run: make docker-build docker-push build-binaries | ||
env: | ||
TAG: ${{ github.event.inputs.tag }} | ||
- name: Create Release | ||
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
with: | ||
args: 'clusterlint-*' | ||
# uses the HEAD on the default branch when creating the tag | ||
tag_name: ${{ github.event.inputs.tag }} | ||
release_name: Release ${{ github.event.inputs.tag }} | ||
files: | | ||
clusterlint-* |
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
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,29 @@ | ||
# Image URL to use all building/pushing image targets | ||
IMG ?= digitalocean/clusterlint | ||
TAG ?= dev | ||
|
||
# Build the docker image | ||
docker-build: | ||
docker build . -t ${IMG}:${TAG} | ||
|
||
# Push the docker image | ||
docker-push: | ||
docker push ${IMG}:${TAG} | ||
|
||
# Build all binaries and sha sums for release | ||
build-binaries: | ||
GOOS=linux GOARCH=amd64 go build -mod=vendor -o clusterlint ./cmd/clusterlint; tar -czvf clusterlint-${TAG}-linux-amd64.tar.gz ./clusterlint | ||
GOOS=linux GOARCH=386 go build -mod=vendor -o clusterlint ./cmd/clusterlint; tar -czvf clusterlint-${TAG}-linux-386.tar.gz ./clusterlint | ||
GOOS=darwin GOARCH=amd64 go build -mod=vendor -o clusterlint ./cmd/clusterlint; tar -czvf clusterlint-${TAG}-darwin-amd64.tar.gz ./clusterlint | ||
GOOS=darwin GOARCH=arm64 go build -mod=vendor -o clusterlint ./cmd/clusterlint; tar -czvf clusterlint-${TAG}-darwin-arm64.tar.gz ./clusterlint | ||
GOOS=windows GOARCH=amd64 go build -mod=vendor -o clusterlint.exe ./cmd/clusterlint; tar -czvf clusterlint-${TAG}-windows-amd64.tar.gz ./clusterlint | ||
GOOS=windows GOARCH=386 go build -mod=vendor -o clusterlint.exe ./cmd/clusterlint; tar -czvf clusterlint-${TAG}-windows-386.tar.gz ./clusterlint | ||
sha256sum clusterlint-${TAG}-linux-amd64.tar.gz >> clusterlint-${TAG}-checksums.sha256 | ||
sha256sum clusterlint-${TAG}-linux-386.tar.gz >> clusterlint-${TAG}-checksums.sha256 | ||
sha256sum clusterlint-${TAG}-darwin-amd64.tar.gz >> clusterlint-${TAG}-checksums.sha256 | ||
sha256sum clusterlint-${TAG}-darwin-arm64.tar.gz >> clusterlint-${TAG}-checksums.sha256 | ||
sha256sum clusterlint-${TAG}-windows-amd64.tar.gz >> clusterlint-${TAG}-checksums.sha256 | ||
sha256sum clusterlint-${TAG}-windows-386.tar.gz >> clusterlint-${TAG}-checksums.sha256 | ||
|
||
|
||
|
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