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 ba2dcd7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 17 deletions.
10 changes: 10 additions & 0 deletions .github/actions/ci/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
Expand Down
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

0 comments on commit ba2dcd7

Please sign in to comment.