Release #60
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
name: Release | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: write | |
deployments: read | |
packages: none | |
env: | |
GO111MODULE: on | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set up Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version-file: "go.mod" | |
cache: false | |
id: go | |
# Read changelog and read versions etc. | |
- name: Check version is mentioned in Changelog.md | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@b97ce03a10d9bdbb07beb491c76a5a01d78cd3ef # v2.2.2 | |
with: | |
validation_depth: 10 | |
path: "CHANGELOG.md" | |
# Check if the newest tag already exists | |
- name: Check if tag exist | |
uses: mukunku/tag-exists-action@5dfe2bf779fe5259360bb10b2041676713dcc8a3 # v1.1.0 | |
id: check-tag-exists | |
with: | |
tag: "v${{ steps.changelog_reader.outputs.version }} release" # following the pattern of vx.x.xx release used in this repo | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Create Release with artifacts | |
- name: Create Kubelogin Release | |
id: create_release | |
if: ${{ steps.check-tag-exists.outputs.exists == 'false'}} | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ steps.changelog_reader.outputs.version }}" | |
name: "v${{ steps.changelog_reader.outputs.version }} release" # following the pattern of vx.x.xx release used in this repo | |
body: ${{ steps.changelog_reader.outputs.changes }} | |
# We need the latest tag in the git local workspace before it start building. | |
- name: Get tags | |
run: git fetch --tags | |
- name: Build (linux) | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
run: make | |
- name: Build (linux/arm64) | |
env: | |
GOOS: linux | |
GOARCH: arm64 | |
run: make | |
- name: Build (linux/armv7) | |
env: | |
GOOS: linux | |
GOARCH: arm | |
GOARM: "7" | |
run: make | |
- name: Build (darwin) | |
env: | |
GOOS: darwin | |
GOARCH: amd64 | |
run: make | |
- name: Build (darwin/arm) | |
env: | |
GOOS: darwin | |
GOARCH: arm64 | |
run: make | |
- name: Build (windows) | |
env: | |
GOOS: windows | |
GOARCH: amd64 | |
run: make | |
- name: Build (windows/arm) | |
env: | |
GOOS: windows | |
GOARCH: arm64 | |
run: make | |
- name: Zip | |
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1 | |
with: | |
args: zip -qq -r kubelogin.zip bin | |
- name: Zip (win-amd64) | |
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1 | |
with: | |
args: zip -qq kubelogin-win-amd64.zip bin/windows_amd64/kubelogin.exe | |
- name: Zip (win-arm64) | |
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1 | |
with: | |
args: zip -qq kubelogin-win-arm64.zip bin/windows_arm64/kubelogin.exe | |
- name: Zip (darwin-amd64) | |
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1 | |
with: | |
args: zip -qq kubelogin-darwin-amd64.zip bin/darwin_amd64/kubelogin | |
- name: Zip (darwin-arm64) | |
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1 | |
with: | |
args: zip -qq kubelogin-darwin-arm64.zip bin/darwin_arm64/kubelogin | |
- name: Zip (linux-amd64) | |
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1 | |
with: | |
args: zip -qq kubelogin-linux-amd64.zip bin/linux_amd64/kubelogin | |
- name: Zip (linux-arm64) | |
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1 | |
with: | |
args: zip -qq kubelogin-linux-arm64.zip bin/linux_arm64/kubelogin | |
- name: Zip (linux-armv7) | |
uses: montudor/action-zip@a8e75c9faefcd80fac3baf53ef40b9b119d5b702 # v1 | |
with: | |
args: zip -qq kubelogin-linux-armv7.zip bin/linux_armv7/kubelogin | |
- name: Create sha256 Checksums | |
run: | | |
sha256sum kubelogin.zip > kubelogin.zip.sha256 | |
sha256sum kubelogin-win-amd64.zip > kubelogin-win-amd64.zip.sha256 | |
sha256sum kubelogin-win-arm64.zip > kubelogin-win-arm64.zip.sha256 | |
sha256sum kubelogin-darwin-amd64.zip > kubelogin-darwin-amd64.zip.sha256 | |
sha256sum kubelogin-darwin-arm64.zip > kubelogin-darwin-arm64.zip.sha256 | |
sha256sum kubelogin-linux-amd64.zip > kubelogin-linux-amd64.zip.sha256 | |
sha256sum kubelogin-linux-arm64.zip > kubelogin-linux-arm64.zip.sha256 | |
sha256sum kubelogin-linux-armv7.zip > kubelogin-linux-armv7.zip.sha256 | |
- name: Publish | |
uses: skx/github-action-publish-binaries@44887b225ceca96efd8a912d39c09ad70312af31 # master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: kubelogin.zip kubelogin-win-amd64.zip kubelogin-win-arm64.zip kubelogin-darwin-amd64.zip kubelogin-darwin-arm64.zip kubelogin-linux-amd64.zip kubelogin-linux-arm64.zip kubelogin-linux-armv7.zip kubelogin.zip.sha256 kubelogin-win-amd64.zip.sha256 kubelogin-win-arm64.zip.sha256 kubelogin-darwin-amd64.zip.sha256 kubelogin-darwin-arm64.zip.sha256 kubelogin-linux-amd64.zip.sha256 kubelogin-linux-arm64.zip.sha256 kubelogin-linux-armv7.zip.sha256 | |
releaseId: ${{ steps.create_release.outputs.id }} |