Skip to content

Commit

Permalink
chore: add Github action to build provider
Browse files Browse the repository at this point in the history
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
tommyknows committed Nov 23, 2023
1 parent 0572411 commit 1a61260
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 207 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/go.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/issue-comment-created.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/labeler.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/lock.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/pull-request-reviewer.yml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/pull-request-size.yml

This file was deleted.

94 changes: 52 additions & 42 deletions .github/workflows/release.yml
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-azurerm.linux.amd64 .
- name: Verify Boringcrypto
run: |
go run rsc.io/goversion@master -crypto bin/terraform-provider-azurerm.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-azurerm.darwin.arm64 .
release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/snyk'
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-azurerm.*.*
makeLatest: true
25 changes: 0 additions & 25 deletions .github/workflows/stale.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/upstream-mm.yml

This file was deleted.

0 comments on commit 1a61260

Please sign in to comment.