Skip to content

Commit

Permalink
feat(ci): initial addition of release github action
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrt committed Jun 30, 2022
1 parent 042f263 commit f63f211
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- main
- mvp
- release-*
push:
tags:
- '*'

jobs:
static:
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
# Workaround step for act
- name: Install sudo package
if: env.ACT == 'true'
run: apt update && apt install sudo

- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.17

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install make git -y
- name: Build (all OS)
run: make all
env:
RELEASE_TAG: ${{ github.ref_name }}

- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GH_TOKEN }}
files: |
openshift-provider-cert*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
openshift-provider-cert
kubeconfig
.idea/

dist/
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ export CGO_ENABLED=0
VERSION=$(shell git rev-parse --short HEAD)
RELEASE_TAG ?= 0.0.0

GO_BUILD_FLAGS := -ldflags '-X github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg/version.commit=$(VERSION) -X github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg/version.version=$(RELEASE_TAG)'
GO_BUILD_FLAGS := -ldflags '-s -w -X github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg/version.commit=$(VERSION) -X github.com/redhat-openshift-ecosystem/provider-certification-tool/pkg/version.version=$(RELEASE_TAG)'

# Unset GOFLAG for CI and ensure we've got nothing accidently set
unexport GOFLAGS

.PHONY: all
all: linux-amd64 cross-build-windows-amd64 cross-build-darwin-amd64 cross-build-darwin-arm64

.PHONY: build
build:
go build -o openshift-provider-cert $(GO_BUILD_FLAGS)
Expand All @@ -24,17 +27,21 @@ update:
verify-codegen:
./hack/verify-codegen.sh

.PHONY: linux-amd64
linux-amd64:
GOOS=linux GOARCH=amd64 go build -o openshift-provider-cert-linux-amd64 $(GO_BUILD_FLAGS)

.PHONY: cross-build-windows-amd64
cross-build-windows-amd64:
GOOS=windows GOARCH=amd64 go build -o openshift-provider-cert.exe $(GO_BUILD_FLAGS)
GOOS=windows GOARCH=amd64 go build -o openshift-provider-cert-windows.exe $(GO_BUILD_FLAGS)

.PHONY: cross-build-darwin-amd64
cross-build-darwin-amd64:
GOOS=darwin GOARCH=amd64 go build -o openshift-provider-cert $(GO_BUILD_FLAGS)
GOOS=darwin GOARCH=amd64 go build -o openshift-provider-cert-darwin-amd64 $(GO_BUILD_FLAGS)

.PHONY: cross-build-darwin-arm64
cross-build-darwin-arm64:
GOOS=darwin GOARCH=arm64 go build -o openshift-provider-cert $(GO_BUILD_FLAGS)
GOOS=darwin GOARCH=arm64 go build -o openshift-provider-cert-darwin-arm64 $(GO_BUILD_FLAGS)


.PHONY: test
Expand Down

0 comments on commit f63f211

Please sign in to comment.