diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index bc92a7b..edeb6dc 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -24,13 +24,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - - - name: Unshallow - run: git fetch --prune --unshallow + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5 with: cache: true go-version-file: 'go.mod' @@ -38,7 +38,7 @@ jobs: - name: Configure Git env: - TOKEN: ${{ secrets.HCP_SDK_PIPELINE_TOKEN }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git config --global advice.detachedHead false git config --global url."https://${TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" @@ -93,11 +93,9 @@ jobs: git diff @{upstream} @ - name: Release New Version - if: success() && github.ref_name == 'main' && steps.changes.outputs.HAS_CHANGES == 'true' && ${{ !inputs.skip-release }} + if: success() && github.ref_name == 'master' && steps.changes.outputs.HAS_CHANGES == 'true' && ${{ !inputs.skip-release }} run: | git tag -a ${NEW_VERSION} -m "New version ${NEW_VERSION}" - echo "Git configuration:" - git config -l echo "Pushing new tag to remote, which will trigger the Release workflow" git push --tags diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6f2a96..c4668bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,35 +1,44 @@ # This GitHub action can publish assets for release when a tag is created. name: release + on: + pull_request: push: + # run only against tags tags: - - 'v*' + - "v*" + +permissions: + contents: write + jobs: goreleaser: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - - name: Unshallow - run: git fetch --prune --unshallow + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v4 with: cache: true go-version-file: 'go.mod' cache-dependency-path: go.sum - + - name: Import GPG key id: import_gpg - uses: paultyng/ghaction-import-gpg@v2.1.0 + uses: crazy-max/ghaction-import-gpg@v6 env: - GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} - PASSPHRASE: ${{ secrets.PASSPHRASE }} + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --rm-dist + args: release --clean 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 index 85157af..a4a9dc8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -30,9 +30,10 @@ checksum: algorithm: sha256 signs: - artifacts: checksum + cmd: gpg2 args: - "--batch" - - "--local-user" + - "-u" - "{{ .Env.GPG_FINGERPRINT }}" - "--output" - "${signature}"