diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..edcee69e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' + +permissions: + contents: write + +jobs: + go-version: + 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: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + 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 + 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@v1 + secrets: + hc-releases-aws-access-key-id: '${{ secrets.TF_PROVIDER_RELEASE_AWS_ACCESS_KEY_ID }}' + hc-releases-aws-secret-access-key: '${{ secrets.TF_PROVIDER_RELEASE_AWS_SECRET_ACCESS_KEY }}' + hc-releases-aws-role-arn: '${{ secrets.TF_PROVIDER_RELEASE_AWS_ROLE_ARN }}' + hc-releases-fastly-api-token: '${{ secrets.FASTLY_STATIC_PURGE_TOKEN }}' + hc-releases-github-token: '${{ secrets.HC_RELEASES_TOKEN }}' + hc-releases-terraform-registry-sync-token: '${{ secrets.TF_PROVIDER_RELEASE_TERRAFORM_REGISTRY_SYNC_TOKEN }}' + setup-signore-github-token: '${{ secrets.SETUP_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 }}' diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..af5d6cb3 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,72 @@ +archives: + - files: + # Ensure only built binary is archived + - 'none*' + format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' +before: + hooks: + - 'go mod download' +builds: + - # Binary naming only required for Terraform CLI 0.12 + binary: '{{ .ProjectName }}_v{{ .Version }}_x5' + env: + - CGO_ENABLED=0 + flags: + - -trimpath + goos: + - darwin + - freebsd + - linux + - windows + goarch: + - '386' + - amd64 + - arm + - arm64 + ignore: + - goarch: arm + goos: windows + - goarch: arm64 + goos: freebsd + - goarch: arm64 + goos: windows + ldflags: + - -s -w -X main.Version={{.Version}} + mod_timestamp: '{{ .CommitTimestamp }}' +checksum: + algorithm: sha256 + extra_files: + - glob: 'terraform-registry-manifest.json' + name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' + name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' +publishers: + - checksum: true + # Terraform CLI 0.10 - 0.11 perform discovery via HTTP headers on releases.hashicorp.com + # For providers which have existed since those CLI versions, exclude + # discovery by setting the protocol version headers to 5. + cmd: hc-releases upload-file {{ abs .ArtifactPath }} -header=x-terraform-protocol-version=5 -header=x-terraform-protocol-versions=5.0 + env: + - AWS_ACCESS_KEY_ID={{ .Env.AWS_ACCESS_KEY_ID }} + - AWS_SECRET_ACCESS_KEY={{ .Env.AWS_SECRET_ACCESS_KEY }} + - AWS_SESSION_TOKEN={{ .Env.AWS_SESSION_TOKEN }} + name: hc-releases + signature: true +release: + extra_files: + - glob: 'terraform-registry-manifest.json' + name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' + ids: + - none +signs: + - args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"] + artifacts: checksum + cmd: signore + signature: ${artifact}.sig + - args: ["sign", "--dearmor", "--file", "${artifact}", "--out", "${signature}"] + artifacts: checksum + cmd: signore + id: key-id + signature: ${artifact}.72D7468F.sig +snapshot: + name_template: "{{ .Tag }}-next" diff --git a/.tfproto5 b/.tfproto5 deleted file mode 100644 index 731055f5..00000000 --- a/.tfproto5 +++ /dev/null @@ -1,4 +0,0 @@ - ____ ____ ____ ____ ____ ____ ____ ____ -||T |||F |||P |||R |||O |||T |||O |||5 || -||__|||__|||__|||__|||__|||__|||__|||__|| -|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\| diff --git a/terraform-registry-manifest.json b/terraform-registry-manifest.json new file mode 100644 index 00000000..a8286e38 --- /dev/null +++ b/terraform-registry-manifest.json @@ -0,0 +1,6 @@ +{ + "version": 1, + "metadata": { + "protocol_versions": ["5.0"] + } +} \ No newline at end of file