From 67e2c81078b42640676f1df7cd4d93b605c9e08d Mon Sep 17 00:00:00 2001 From: jsilvas Date: Sat, 5 Oct 2024 21:23:46 -0500 Subject: [PATCH] Consolidate github actions. --- .github/workflows/prepare.yml | 31 ------------------------------- .github/workflows/release.yml | 24 ++++++++++++++++++++++-- 2 files changed, 22 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/prepare.yml diff --git a/.github/workflows/prepare.yml b/.github/workflows/prepare.yml deleted file mode 100644 index fe69f6d3..00000000 --- a/.github/workflows/prepare.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: "Terraform Provider Release" - -on: - push: - branches: - - "main" - -# Releases need permissions to read and write the repository contents. -# GitHub considers creating releases and uploading assets as writing contents. -permissions: - contents: "write" - -jobs: - release-tag: - runs-on: "ubuntu-latest" - steps: - - name: "Checkout" - uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" # v4.1.7 - with: - fetch-depth: 0 - ref: "refs/heads/main" - # Avoid persisting GITHUB_TOKEN credentials as they take priority over our service account PAT for `git push` operations - # More details: https://github.com/actions/checkout/blob/b4626ce19ce1106186ddf9bb20e706842f11a7c3/adrs/0153-checkout-v2.md#persist-credentials - persist-credentials: false - - - name: "Git Push Release Tag" - run: | - export VERSION=$(cat VERSION) - echo "Publishing tag $VERSION for release." - git tag $VERSION - git push https://git:${{ secrets.GITHUB_TOKEN }}@github.com/josh-silvas/terraform-provider-awx $VERSION diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ce3e056..0ae3c708 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,8 +4,8 @@ name: "Terraform Provider Release" # "v*" (e.g. v0.1.0) is created. on: push: - tags: - - 'v*' + branches: + - "main" # Releases need permissions to read and write the repository contents. # GitHub considers creating releases and uploading assets as writing contents. @@ -13,8 +13,28 @@ permissions: contents: "write" jobs: + release-tag: + runs-on: "ubuntu-latest" + steps: + - name: "Checkout" + uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" # v4.1.7 + with: + fetch-depth: 0 + ref: "refs/heads/main" + # Avoid persisting GITHUB_TOKEN credentials as they take priority over our service account PAT for `git push` operations + # More details: https://github.com/actions/checkout/blob/b4626ce19ce1106186ddf9bb20e706842f11a7c3/adrs/0153-checkout-v2.md#persist-credentials + persist-credentials: false + + - name: "Git Push Release Tag" + run: | + export VERSION=$(cat VERSION) + echo "Publishing tag $VERSION for release." + git tag $VERSION + git push https://git:${{ secrets.GITHUB_TOKEN }}@github.com/josh-silvas/terraform-provider-awx $VERSION + goreleaser: runs-on: "ubuntu-latest" + needs: ["release-tag"] steps: - uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" # v3.5.3 with: