diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a7fe726 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,16 @@ +name: build + +on: [ push ] + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: '1.23' + - name: Run build + run: go build \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d84a265 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ + +#Source: https://github.com/hashicorp/terraform-provider-scaffolding/blob/main/.github/workflows/release.yml +name: release +on: + push: + tags: + - 'v*' +jobs: + goreleaser: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + - name: Unshallow + run: git fetch --prune --unshallow + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.23 + - name: Import GPG key + id: import_gpg + uses: Ferlab-Ste-Justine/ghaction-import-gpg@main + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + PASSPHRASE: ${{ secrets.PASSPHRASE }} + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2.7.0 + with: + version: 1.10.3 + args: release --rm-dist + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..97c431f --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,45 @@ +#Source: https://github.com/hashicorp/terraform-provider-scaffolding/blob/main/.goreleaser.yml +before: + hooks: + - go mod tidy +builds: +- env: + - CGO_ENABLED=0 + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - -trimpath + ldflags: + - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' + goos: + - windows + - linux + - darwin + goarch: + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm64 + - goos: darwin + goarch: arm64 + binary: '{{ .ProjectName }}' +archives: +- format: tar.gz + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' + algorithm: sha256 +signs: + - artifacts: checksum + args: + - "--batch" + - "--local-user" + - "{{ .Env.GPG_FINGERPRINT }}" + - "--output" + - "${signature}" + - "--detach-sign" + - "${artifact}" +release: + # draft: true +changelog: + skip: true \ No newline at end of file