Use "hectorm/ghaction-release" action

This commit is contained in:
Héctor Molinero Fernández 2024-07-20 15:40:34 +02:00
parent efd183861a
commit d602925a09

View File

@ -122,29 +122,13 @@ jobs:
run: |
make push-cross-manifest

release-github:
name: "Create GitHub release"
publish-github-release:
name: "Publish GitHub release"
if: "startsWith(github.ref, 'refs/tags/v')"
needs: ["push-manifest"]
runs-on: "ubuntu-latest"
permissions:
contents: "write"
steps:
- name: "Create release"
env:
GITHUB_PAT: "${{ secrets.GITHUB_TOKEN }}"
run: |
RELEASE_STATUS="$(curl -fs --proto '=https' --tlsv1.3 --globoff \
--url "https://api.github.com/repos/${GITHUB_REPOSITORY:?}/releases/tags/${GITHUB_REF_NAME:?}" \
--header "Authorization: Bearer ${GITHUB_PAT:?}" \
--header 'Accept: application/vnd.github.v3+json' \
--header 'Content-Type: application/json' \
--write-out '%{http_code}' --output /dev/null ||:)"
if [ "${RELEASE_STATUS:?}" = '200' ]; then exit 0; fi
RELEASE_ID="$(curl -fsS --proto '=https' --tlsv1.3 --globoff \
--url "https://api.github.com/repos/${GITHUB_REPOSITORY:?}/releases" \
--header "Authorization: Bearer ${GITHUB_PAT:?}" \
--header 'Accept: application/vnd.github.v3+json' \
--header 'Content-Type: application/json' \
--data "$(jq -rn --arg tag "${GITHUB_REF_NAME:?}" '{"name": $tag, "tag_name": $tag, "generate_release_notes": true}')" | jq -r '.id')"
if [ -z "${RELEASE_ID-}" ] || [ "${RELEASE_ID:?}" = 'null' ]; then exit 1; fi
- name: "Publish"
uses: "hectorm/ghaction-release@066200d04c3549852afa243d631ea3dc93390f68"