Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checksum generation and release asset upload to GitHub Actions workflow #10

Merged
merged 20 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions .github/workflows/go-provider.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
name: provider
permissions:
contents: write
packages: write
name: Provider Release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# tags:
# - 'v*'
jobs:
build:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build
run: |
go get .
go install github.com/mitchellh/gox@latest
make build
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --snapshot --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 changes: 81 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: 2
archives:
- files:
# Ensure only built binary and license file are archived
- 'LICENSE'
format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
before:
hooks:
- 'go mod download'
- 'go mod tidy'
builds:
- # Binary naming only required for Terraform CLI 0.12
binary: '{{ .ProjectName }}_{{ .Version }}'
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 -product {{ .ProjectName }} -version {{ .Version }} -file={{ .ArtifactPath }}={{ .ArtifactName }} -header=x-terraform-protocol-version=5 -header=x-terraform-protocol-versions=5.0
env:
- HC_RELEASES_HOST={{ .Env.HC_RELEASES_HOST }}
- HC_RELEASES_KEY={{ .Env.HC_RELEASES_KEY }}
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
name: upload
signature: true
milestones:
- close: true
release:
extra_files:
- glob: 'terraform-registry-manifest.json'
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
ids:
- none
draft: true
signs:
- artifacts: checksum
args:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
disable: true
17 changes: 12 additions & 5 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ ifndef QDRANT_CLOUD_ACCOUNT_ID
endif
TF_ACC=1 go test ./qdrant/... -v $(TESTARGS) -timeout 120m

requirements:
go install github.com/goreleaser/goreleaser/v2@latest
go install github.com/mitchellh/gox@latest

generate-client:
cd internal && swagger-codegen generate -i ./spec.json -l go --output client --additional-properties packageName=cloud

build:
CGO_ENABLED=0 gox \
-osarch="linux/amd64 linux/arm linux/arm64 darwin/amd64 darwin/arm64 windows/amd64" \
-output="bin/{{.OS}}/{{.Arch}}/${BINARY}_v$(VERSION)" \
-tags="netgo" \
./...
goreleaser release --snapshot --clean

build: requirements
goreleaser release --snapshot --clean

.PHONY: update-go-client
update-go-client:
Expand All @@ -45,3 +48,7 @@ install: build
.PHONY: generate-help
generate-help:
go generate ./...

.PHONY: checksum
checksum:
find bin -type f -exec sha256sum {} \; > checksums.txt
5 changes: 4 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ provider "qdrant-cloud" {
<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `api_key` (String) The API Key for Qdrant Cloud API operations.

### Optional

- `account_id` (String) Default Account Identifier for the Qdrant cloud
- `api_key` (String) The API Key for Qdrant Cloud API operations.
- `api_url` (String) The URL of the Qdrant Cloud API.
6 changes: 6 additions & 0 deletions terraform-registry-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": 1,
"metadata": {
"protocol_versions": ["5.0"]
}
}