From bc91c65f0f1bf5162a6c94b15d3367b60ec4c3bc Mon Sep 17 00:00:00 2001 From: Dean Roehrich Date: Tue, 13 Feb 2024 13:26:55 -0600 Subject: [PATCH] Use softprops/action-gh-release to create releases Pushing a 'v*' tag automatically creates a release. Signed-off-by: Dean Roehrich --- .github/workflows/handle_release_tag.yaml | 27 ++++++++++++++++++++++ .github/workflows/main.yml | 14 +----------- .github/workflows/verify_tag.yml | 28 ----------------------- 3 files changed, 28 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/handle_release_tag.yaml delete mode 100644 .github/workflows/verify_tag.yml diff --git a/.github/workflows/handle_release_tag.yaml b/.github/workflows/handle_release_tag.yaml new file mode 100644 index 00000000..9ae92446 --- /dev/null +++ b/.github/workflows/handle_release_tag.yaml @@ -0,0 +1,27 @@ +name: Handle Release Tag + +on: + push: + tags: + - 'v*' + +jobs: + create_release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + fetch-tags: true + fetch-depth: 0 + - name: Repair tag + run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} + - name: Verify that the tag is annotated + run: if test x$(git for-each-ref ${{ github.ref }} | awk '{print $2}') = xtag; then /bin/true; else echo "\"${{ github.ref }}\" does not look like an annotated tag!"; /bin/false; fi + - name: Release + uses: softprops/action-gh-release@v1 + with: + #prerelease: true + generate_release_notes: true + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 90c2c21e..b409a335 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,15 +1,6 @@ name: Docker build and push -on: - push: - branches: - - '*' - tags: - - 'v*' - pull_request: - branches: - - 'master' - - 'releases/v*' +on: [push] env: # TEST_TARGET: Name of the testing target in the Dockerfile @@ -18,9 +9,6 @@ env: # DO_TEST - true to build and run unit tests, false to skip the tests DO_TEST: true - # DO_PUSH - true to push to the HPE_DEPLOY_REPO, false to not push - DO_PUSH: true - jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/verify_tag.yml b/.github/workflows/verify_tag.yml deleted file mode 100644 index 2a75d910..00000000 --- a/.github/workflows/verify_tag.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Pushing a tag triggers this workflow, which verifies that it is an -# annotated tag. -name: Verify tag - -on: - push: - tags: - - "v*" - -jobs: - verify_tag: - runs-on: ubuntu-latest - steps: - - name: "Verify context" - run: | - echo "ref is ${{ github.ref }}" - echo "ref_type is ${{ github.ref_type }}" - - - uses: actions/checkout@v3 - # actions/checkout@v3 breaks annotated tags by converting them into - # lightweight tags, so we need to force fetch the tag again - # See: https://github.com/actions/checkout/issues/290 - - name: "Repair tag" - run: git fetch -f origin ${{ github.ref }}:${{ github.ref }} - - name: "Verify tag is annotated" - run: if test x$(git for-each-ref ${{ github.ref }} | awk '{print $2}') = xtag; then /bin/true; else echo "\"${{ github.ref }}\" does not look like an annotated tag!"; /bin/false; fi - - name: "Echo release tag" - run: echo "TAG=${{ github.repository }}:${{ github.ref }}"