Skip to content

Commit

Permalink
Merge pull request #458 from HarrisonWAffel/gha-migration
Browse files Browse the repository at this point in the history
Migrate to Github Actions
  • Loading branch information
HarrisonWAffel authored May 22, 2024
2 parents c8755ad + 6edc586 commit 22afb27
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 86 deletions.
73 changes: 0 additions & 73 deletions .drone.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Prerelease

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: build binaries
env:
CROSS: 1
VERSION: ${{ github.ref_name }}
run: |
make build
- name: package
run: |
make package
- name: retrieve GPG Credentials
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/key/app-credentials passphrase | GPG_PASSPHRASE ;
secret/data/github/repo/${{ github.repository }}/key/app-credentials privateKey | GPG_KEY
- name: sign SHASUM
env:
GPG_KEY: ${{ env.GPG_KEY }}
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
run: |
echo "Importing gpg key"
echo -n "${{ env.GPG_KEY }}" | base64 --decode | gpg --import --batch >/dev/null
echo "signing SHASUM file"
VERSION_NO_V=$(echo ${{ github.ref_name }} | sed "s/^[v|V]//")
SHASUM_FILE=dist/artifacts/${{ github.ref_name }}/terraform-provider-rke_"$VERSION_NO_V"_SHA256SUMS
echo ${{ env.GPG_PASSPHRASE }} | gpg --detach-sig --pinentry-mode loopback --passphrase-fd 0 --output "$SHASUM_FILE".sig --sign "$SHASUM_FILE"
- name: GH release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ github.ref_name }} --prerelease --verify-tag --generate-notes ./dist/artifacts/${{ github.ref_name }}/*
50 changes: 50 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: build binaries
env:
CROSS: 1
VERSION: ${{ github.ref_name }}
run: |
make build
- name: package
run: |
make package
- name: retrieve GPG Credentials
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/key/app-credentials passphrase | GPG_PASSPHRASE ;
secret/data/github/repo/${{ github.repository }}/key/app-credentials privateKey | GPG_KEY
- name: sign SHASUM
env:
GPG_KEY: ${{ env.GPG_KEY }}
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
run: |
echo "Importing gpg key"
echo -n "${{ env.GPG_KEY }}" | base64 --decode | gpg --import --batch >/dev/null
echo "signing SHASUM file"
VERSION_NO_V=$(echo ${{ github.ref_name }} | sed "s/^[v|V]//")
SHASUM_FILE=dist/artifacts/${{ github.ref_name }}/terraform-provider-rke_"$VERSION_NO_V"_SHA256SUMS
echo ${{ env.GPG_PASSPHRASE }} | gpg --detach-sig --pinentry-mode loopback --passphrase-fd 0 --output "$SHASUM_FILE".sig --sign "$SHASUM_FILE"
- name: GH release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ github.ref_name }} --verify-tag --generate-notes ./dist/artifacts/${{ github.ref_name }}/*
15 changes: 2 additions & 13 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
GO111MODULE=off
WEBSITE_REPO=github.com/hashicorp/terraform-website
PKG_NAME=rke
TEST?="./${PKG_NAME}"
Expand All @@ -19,7 +18,7 @@ dapper-testacc: .dapper
build: validate
@sh -c "'$(CURDIR)/scripts/gobuild.sh'"

validate: vet lint fmtcheck
validate: vet fmtcheck

package:
@sh -c "'$(CURDIR)/scripts/gopackage.sh'"
Expand All @@ -41,23 +40,13 @@ testacc:

vet:
@echo "==> Checking that code complies with go vet requirements..."
@go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -gt 0 ]; then \
@go vet ./... ; if [ $$? -gt 0 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi

lint:
@echo "==> Checking that code complies with golint requirements..."
@GO111MODULE=off go get -u golang.org/x/lint/golint
@if [ -n "$$(golint $$(go list ./...) | grep -v 'should have comment.*or be unexported' | tee /dev/stderr)" ]; then \
echo ""; \
echo "golint found style issues. Please check the reported issues"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi

bin:
go build -o $(PROVIDER_NAME)

Expand Down

0 comments on commit 22afb27

Please sign in to comment.