Skip to content

Commit

Permalink
test-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
shilgapira committed Aug 25, 2024
1 parent c4c8ad9 commit 9fc5f2b
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 21 deletions.
17 changes: 17 additions & 0 deletions .github/actions/ci/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
Expand Down
2 changes: 0 additions & 2 deletions .github/actions/ci/lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 26 additions & 0 deletions .github/actions/ci/release/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}
16 changes: 11 additions & 5 deletions .goreleaser.yml → .github/actions/ci/release/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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
16 changes: 5 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 9fc5f2b

Please sign in to comment.