From 27ea5c66ebfa92514933f12786ed5a7e44fbfbfe Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 21 Oct 2022 20:28:07 -0500 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1466b59..ced17f55 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,19 +11,39 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 + submodules: 'true' + token: ${{ secrets.ORG_GITHUB_TOKEN }} - name: Fetch All Tags run: git fetch --force --tags - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.18 + - name: Cache Go modules + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Import GPG Key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} - name: Set Release Version id: version run: | echo "::set-output name=RELEASE_VERSION::$(date +v%Y.%-m.%-d)" + - name: Ensure Release Does Not Exist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release delete ${{ steps.version.outputs.RELEASE_VERSION }} || true - name: Set Package Version run: | cat << EOF > version.go @@ -48,17 +68,6 @@ jobs: fi git tag -f ${{ steps.version.outputs.RELEASE_VERSION }} -m "Cut Release '${{ steps.version.outputs.RELEASE_VERSION }}'" git push -f origin refs/tags/${{ steps.version.outputs.RELEASE_VERSION }} - - name: Ensure Release Does Not Exist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release delete ${{ steps.version.outputs.RELEASE_VERSION }} || true - - name: Import GPG Key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2.7.0 with: @@ -66,6 +75,7 @@ jobs: env: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} - name: Report Release To OpsLevel uses: opslevel/report-deploy-github-action@v0.2.0 with: