diff --git a/.github/actions/ci/build/action.yml b/.github/actions/ci/build/action.yml index bab2180..dc6f141 100644 --- a/.github/actions/ci/build/action.yml +++ b/.github/actions/ci/build/action.yml @@ -15,6 +15,23 @@ runs: with: go_version: ${{ inputs.go_version }} + - name: Check Go Files + shell: bash + run: | + echo "Running go mod tidy" + set +e + go mod tidy + if [ "$?" != "0" ]; then + echo "Unexpected error running 'go mod tidy'" + exit 1 + fi + echo "Checking for diffs" + git diff --exit-code + if [ "$?" != "0" ]; then + echo "Unexpected diff after running 'go mod tidy'" + exit 1 + fi + - name: Build Code shell: bash run: go build -v ./... diff --git a/.github/actions/ci/lint/action.yml b/.github/actions/ci/lint/action.yml index bf54389..9eb06c7 100644 --- a/.github/actions/ci/lint/action.yml +++ b/.github/actions/ci/lint/action.yml @@ -19,6 +19,4 @@ runs: uses: golangci/golangci-lint-action@v6 with: version: v1.60.3 - skip-pkg-cache: true - skip-build-cache: true args: --config=.github/actions/ci/lint/golangci.yml diff --git a/.github/actions/ci/release/action.yml b/.github/actions/ci/release/action.yml new file mode 100644 index 0000000..e774045 --- /dev/null +++ b/.github/actions/ci/release/action.yml @@ -0,0 +1,26 @@ +name: Run GoReleaser + +description: Run GoReleaser + +inputs: + go_version: + description: 'Version of Go to use for this build' + required: true + +runs: + using: composite + steps: + - name: Setup Repo + uses: ./.github/actions/ci/setup + with: + go_version: ${{ inputs.go_version }} + + - name: Install Cosign + uses: sigstore/cosign-installer@v3 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + args: release --clean --config .github/actions/ci/release/goreleaser.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.github/actions/ci/release/goreleaser.yml similarity index 82% rename from .goreleaser.yml rename to .github/actions/ci/release/goreleaser.yml index e14ef97..aec827c 100644 --- a/.goreleaser.yml +++ b/.github/actions/ci/release/goreleaser.yml @@ -1,13 +1,13 @@ -# Visit https://goreleaser.com for documentation on how to customize this -# behavior. version: 2 + before: hooks: - # this is just an example and not a requirement for provider building/publishing - go mod tidy + env: - CGO_ENABLED=0 - COSIGN_YES=true + builds: - mod_timestamp: "{{ .CommitTimestamp }}" flags: @@ -28,15 +28,18 @@ builds: - goos: darwin goarch: "386" binary: "{{ .ProjectName }}_v{{ .Version }}" + archives: - format: zip name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + checksum: extra_files: - glob: "terraform-registry-manifest.json" name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json" name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS" algorithm: sha256 + signs: - artifacts: checksum cmd: cosign @@ -51,11 +54,14 @@ signs: "${artifact}.pem", "${artifact}", ] + release: + draft: true + replace_existing_draft: true + replace_existing_artifacts: true extra_files: - glob: "terraform-registry-manifest.json" name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json" - # If you want to manually examine the release before its live, uncomment this line: - # draft: true + changelog: disable: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad20a6d..e2e5e86 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,19 +13,13 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Checkout Code + uses: actions/checkout@v4 with: - # Allow goreleaser to access older tag information. - fetch-depth: 0 - - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version-file: "go.mod" - cache: true - - name: Install cosign - uses: sigstore/cosign-installer@v3 + fetch-depth: 0 # Allow goreleaser to access older tag information. - name: Run GoReleaser - uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 + uses: ./.github/actions/ci/release with: - args: release --clean + go_version: '1.22' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/go.mod b/go.mod index 2de9835..f043f33 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( require ( github.com/ProtonMail/go-crypto v1.1.0-alpha.5-proton // indirect - github.com/agext/levenshtein v1.2.3 // indirect + github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/cloudflare/circl v1.4.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/go.sum b/go.sum index 2b2a9b7..4d45c72 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migc github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.1.0-alpha.5-proton h1:KVBEgU3CJpmzLChnLiSuEyCuhGhcMt3eOST+7A+ckto= github.com/ProtonMail/go-crypto v1.1.0-alpha.5-proton/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= -github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= -github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= +github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=