Skip to content

Commit 76ed0cd

Browse files
committed
Initial proof-of-concept version
Note that this does implement all resources we need for now, but these are also far from feature complete
0 parents  commit 76ed0cd

33 files changed

+8335
-0
lines changed

.github/workflows/release.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: release
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
goreleaser:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0
13+
14+
- name: Set up Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version-file: go.mod
18+
19+
- name: Import GPG key
20+
id: import_gpg
21+
uses: paultyng/[email protected]
22+
env:
23+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
24+
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
25+
26+
- name: Run GoReleaser
27+
uses: goreleaser/goreleaser-action@v6
28+
with:
29+
version: latest
30+
args: release --clean
31+
env:
32+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yaml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Run Tests
2+
3+
on: [push]
4+
5+
jobs:
6+
7+
test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: hashicorp/setup-terraform@v3
14+
with:
15+
terraform_version: 1.4.6
16+
terraform_wrapper: false
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version-file: go.mod
22+
23+
- name: golangci-lint
24+
continue-on-error: true
25+
uses: golangci/golangci-lint-action@v6
26+
with:
27+
args: --issues-exit-code=0 --timeout=5m
28+
29+
- name: Run tests
30+
run: go test -race -coverprofile=coverage.out -covermode=atomic -coverpkg=./... -v ./...
31+
env:
32+
TF_ACC: 1
33+
STORYBLOK_URL: https://mapi.storyblok.com
34+
STORYBLOK_TOKEN: foobar
35+
36+
- name: Upload to codecov
37+
uses: codecov/codecov-action@v5
38+
with:
39+
verbose: true
40+
41+
- name: build binary
42+
uses: goreleaser/goreleaser-action@v6
43+
with:
44+
args: build --snapshot --clean --single-target
45+
env:
46+
GOPATH: ${{ env.GOPATH }}
47+
48+
changie:
49+
runs-on: ubuntu-latest
50+
needs: test
51+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
52+
permissions:
53+
contents: write
54+
pull-requests: write
55+
actions: write
56+
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 0
60+
61+
- name: Prepare release
62+
uses: labd/[email protected]
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
release-workflow: 'release.yaml'

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
terraform-provider-*
2+
.terraform/
3+
.terraform.lock.hcl
4+
*.tfstate
5+
*.tf
6+
*.graphql
7+
*.backup
8+
coverage.out
9+
dist/
10+
/local
11+
/.idea
12+
/.env
13+
/NOTES.md

.golangci.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Visit https://golangci-lint.run/ for usage documentation
2+
# and information on other useful linters
3+
issues:
4+
max-per-linter: 0
5+
max-same-issues: 0
6+
7+
linters:
8+
disable-all: true
9+
enable:
10+
- durationcheck
11+
- errcheck
12+
- copyloopvar
13+
- forcetypeassert
14+
- godot
15+
- gofmt
16+
- gosimple
17+
- ineffassign
18+
- makezero
19+
- misspell
20+
- nilerr
21+
- predeclared
22+
- staticcheck
23+
- tenv
24+
- unconvert
25+
- unparam
26+
- unused
27+
- govet

.goreleaser.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
version: 2
4+
before:
5+
hooks:
6+
# this is just an example and not a requirement for provider building/publishing
7+
- go mod tidy
8+
builds:
9+
- env:
10+
# goreleaser does not work with CGO, it could also complicate
11+
# usage by users in CI/CD systems like HCP Terraform where
12+
# they are unable to install libraries.
13+
- CGO_ENABLED=0
14+
mod_timestamp: '{{ .CommitTimestamp }}'
15+
flags:
16+
- -trimpath
17+
ldflags:
18+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
19+
goos:
20+
- freebsd
21+
- windows
22+
- linux
23+
- darwin
24+
goarch:
25+
- amd64
26+
- '386'
27+
- arm
28+
- arm64
29+
ignore:
30+
- goos: darwin
31+
goarch: '386'
32+
binary: '{{ .ProjectName }}_v{{ .Version }}'
33+
archives:
34+
- format: zip
35+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
36+
checksum:
37+
extra_files:
38+
- glob: 'terraform-registry-manifest.json'
39+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
40+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
41+
algorithm: sha256
42+
signs:
43+
- artifacts: checksum
44+
args:
45+
# if you are using this in a GitHub action or some other automated pipeline, you
46+
# need to pass the batch flag to indicate its not interactive.
47+
- "--batch"
48+
- "--local-user"
49+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
50+
- "--output"
51+
- "${signature}"
52+
- "--detach-sign"
53+
- "${artifact}"
54+
release:
55+
extra_files:
56+
- glob: 'terraform-registry-manifest.json'
57+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
58+
# If you want to manually examine the release before its live, uncomment this line:
59+
# draft: true
60+
changelog:
61+
disable: true

0 commit comments

Comments
 (0)