From ba2dcd7b610ba1ad169d9c7d1e4c2f2810588a03 Mon Sep 17 00:00:00 2001 From: Gil Shapira Date: Sun, 25 Aug 2024 12:44:37 +0300 Subject: [PATCH] test-ci --- .github/actions/ci/build/action.yml | 10 +++++++ .github/actions/ci/release/action.yml | 26 +++++++++++++++++++ .../actions/ci/release/goreleaser.yml | 16 ++++++++---- .github/workflows/release.yml | 16 ++++-------- go.mod | 2 +- 5 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 .github/actions/ci/release/action.yml rename .goreleaser.yml => .github/actions/ci/release/goreleaser.yml (82%) diff --git a/.github/actions/ci/build/action.yml b/.github/actions/ci/build/action.yml index bab2180..64fb01c 100644 --- a/.github/actions/ci/build/action.yml +++ b/.github/actions/ci/build/action.yml @@ -15,6 +15,16 @@ runs: with: go_version: ${{ inputs.go_version }} + - name: Check go.mod + shell: bash + run: | + go mod tidy + git diff --compact-summary --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/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