diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5d69236..c456dca4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,6 @@ name: Docker build and push -on: - push: - branches: - - '*' - tags: - - 'v*' +on: [push] env: # TEST_TARGET: Name of the testing target in the Dockerfile @@ -14,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 @@ -98,3 +90,23 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} + create_release: + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + 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/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 }}"