forked from hashicorp/terraform-provider-google
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add Github action to build provider
We want to get rid of the provider-build step in CSE, building the providers in their own repos makes more sense. This Github Action creates a release for every commit that is named `v0.0.0-<commit sha>` and attaches a linux/amd64 and darwin/arm64 binary to it. This commit also removes all unneeded actions that came from / with the fork.
- Loading branch information
1 parent
0572411
commit 7d70dd6
Showing
9 changed files
with
52 additions
and
207 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,51 +1,61 @@ | ||
name: Release | ||
name: Build TF Provider | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+*' | ||
|
||
permissions: | ||
contents: write | ||
on: [push] | ||
|
||
jobs: | ||
go-version: | ||
build: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.go-version.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: go-version | ||
run: echo "::set-output name=version::$(cat ./.go-version)" | ||
release-notes: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21.3 | ||
- name: Install C toolchain | ||
run: | | ||
sudo apt-get update | ||
sudo apt install -y gcc-x86-64-linux-gnu | ||
mkdir bin | ||
- name: Cache Binaries | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-binaries | ||
with: | ||
path: bin | ||
key: ${{ github.sha }} | ||
restore-keys: ${{ github.sha }} | ||
- name: Build Linux binary with Boringcrypto | ||
run: | | ||
CC=x86_64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=amd64 GOOS=linux GOEXPERIMENT=boringcrypto \ | ||
go build -o bin/terraform-provider-google.linux.amd64 . | ||
- name: Verify Boringcrypto | ||
run: | | ||
go run rsc.io/goversion@master -crypto bin/terraform-provider-google.linux.amd64 | grep -q '(boring crypto)' | ||
# boringcrypto isn't available for darwin, so we can also disable CGO. | ||
- name: Build Darwin binary without Boringcrypto | ||
run: | | ||
CGO_ENABLED=0 GOARCH=arm64 GOOS=darwin \ | ||
go build -o bin/terraform-provider-google.darwin.arm64 . | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: github.ref == 'refs/heads/snyk-v1' | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
- name: Cache Binaries | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-binaries | ||
with: | ||
fetch-depth: 0 | ||
- name: Generate Release Notes | ||
run: sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)/q;p" CHANGELOG.md > release-notes.txt | ||
- uses: actions/upload-artifact@v2 | ||
path: bin | ||
key: ${{ github.sha }} | ||
restore-keys: ${{ github.sha }} | ||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: release-notes | ||
path: release-notes.txt | ||
retention-days: 1 | ||
terraform-provider-release: | ||
name: 'Terraform Provider Release' | ||
needs: [go-version, release-notes] | ||
uses: hashicorp/ghaction-terraform-provider-release/.github/workflows/hashicorp.yml@v2 | ||
secrets: | ||
hc-releases-github-token: '${{ secrets.HASHI_RELEASES_GITHUB_TOKEN }}' | ||
hc-releases-host-staging: '${{ secrets.HC_RELEASES_HOST_STAGING }}' | ||
hc-releases-host-prod: '${{ secrets.HC_RELEASES_HOST_PROD }}' | ||
hc-releases-key-prod: '${{ secrets.HC_RELEASES_KEY_PROD }}' | ||
hc-releases-key-staging: '${{ secrets.HC_RELEASES_KEY_STAGING }}' | ||
hc-releases-terraform-registry-sync-token: '${{ secrets.TF_PROVIDER_RELEASE_TERRAFORM_REGISTRY_SYNC_TOKEN }}' | ||
setup-signore-github-token: '${{ secrets.HASHI_SIGNORE_GITHUB_TOKEN }}' | ||
signore-client-id: '${{ secrets.SIGNORE_CLIENT_ID }}' | ||
signore-client-secret: '${{ secrets.SIGNORE_CLIENT_SECRET }}' | ||
with: | ||
release-notes: true | ||
setup-go-version: '${{ needs.go-version.outputs.version }}' | ||
# Product Version (e.g. v1.2.3 or github.ref_name) | ||
product-version: '${{ github.ref_name }}' | ||
tag: v0.0.0-${{ github.sha }} | ||
commit: ${{ github.sha }} | ||
artifacts: bin/terraform-provider-google.*.* | ||
makeLatest: true |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.