diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5c5c87..c16bcd2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: tags: - '*' + pull_request: permissions: contents: write @@ -23,12 +24,24 @@ jobs: with: go-version: "1.21" - - + # if tag release + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 + if: startsWith(github.ref, 'refs/tags/v') with: - distribution: goreleaser version: latest args: release --rm-dist env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # if no tag test release build + - + name: Run GoReleaser skip publishing + uses: goreleaser/goreleaser-action@v5 + if: "!startsWith(github.ref, 'refs/tags/v')" + with: + version: latest + args: release --skip=publish --skip=validate + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..4732093 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +name: Test and coverage + +on: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: '1.21' + cache: false + + - name: go get + run: go get ./... + + - name: Run tests + run: go test -v ./... diff --git a/.goreleaser.yml b/.goreleaser.yml index d316720..ed379cc 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -10,11 +10,6 @@ builds: - id: plugin-check mod_timestamp: '{{ .CommitTimestamp }}' - hooks: - # This will check plugin compatibility against latest version of Packer - post: - - go install github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc@latest - - bash -ec 'cd "{{ dir .Path}}" && packer-sdc plugin-check {{ .Name }}' flags: - -trimpath ldflags: @@ -39,6 +34,13 @@ builds: - '386' - arm - arm64 + ignore: + - goos: windows + goarch: arm64 + - goos: darwin + goarch: '386' + - goos: linux + goarch: amd64 archives: - builds: