Fix: restore inputs.version fallback for repository_dispatch triggers (PRI-1753)
Dual Approval (CTO + QA) / dual-approval (pull_request_review) Failing after 1s
Dual Approval (CTO + QA) / dual-approval (pull_request_review) Failing after 1s
Add RESOLVED_VERSION env var to check-tag and release jobs. Replace all
${{ inputs.version }} references with ${{ env.RESOLVED_VERSION }}
to support repository_dispatch when inputs.version is empty.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
committed by
Gandalf the Greybeard [agent]
parent
1ae227885e
commit
81fd75ef89
@@ -114,6 +114,8 @@ jobs:
|
|||||||
needs: check-secrets
|
needs: check-secrets
|
||||||
if: needs.check-secrets.outputs.ready == 'true'
|
if: needs.check-secrets.outputs.ready == 'true'
|
||||||
runs-on: runners-privilegedescalation
|
runs-on: runners-privilegedescalation
|
||||||
|
env:
|
||||||
|
RESOLVED_VERSION: ${{ inputs.version || github.event.client_payload.version }}
|
||||||
outputs:
|
outputs:
|
||||||
skip: ${{ steps.check.outputs.skip }}
|
skip: ${{ steps.check.outputs.skip }}
|
||||||
steps:
|
steps:
|
||||||
@@ -125,9 +127,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
HTTP_CODE=$(curl -sf -o /dev/null -w "%{http_code}" \
|
HTTP_CODE=$(curl -sf -o /dev/null -w "%{http_code}" \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
"https://git.farh.net/api/v1/repos/${REPO}/git/refs/tags/v${{ inputs.version }}")
|
"https://git.farh.net/api/v1/repos/${REPO}/git/refs/tags/v${{ env.RESOLVED_VERSION }}")
|
||||||
if [ "$HTTP_CODE" = "200" ]; then
|
if [ "$HTTP_CODE" = "200" ]; then
|
||||||
echo "::notice::Tag v${{ inputs.version }} already exists. Release skipped (not an error)."
|
echo "::notice::Tag v${{ env.RESOLVED_VERSION }} already exists. Release skipped (not an error)."
|
||||||
echo "skip=true" >> $GITHUB_OUTPUT
|
echo "skip=true" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "skip=false" >> $GITHUB_OUTPUT
|
echo "skip=false" >> $GITHUB_OUTPUT
|
||||||
@@ -138,11 +140,13 @@ jobs:
|
|||||||
if: needs.check-secrets.outputs.ready == 'true' && needs.check-tag.outputs.skip != 'true' && needs.check-token-permissions.outputs.has_write == 'true'
|
if: needs.check-secrets.outputs.ready == 'true' && needs.check-tag.outputs.skip != 'true' && needs.check-token-permissions.outputs.has_write == 'true'
|
||||||
runs-on: runners-privilegedescalation
|
runs-on: runners-privilegedescalation
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
|
env:
|
||||||
|
RESOLVED_VERSION: ${{ inputs.version || github.event.client_payload.version }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Validate version format
|
- name: Validate version format
|
||||||
run: |
|
run: |
|
||||||
if [[ ! "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
if [[ ! "${{ env.RESOLVED_VERSION }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
echo "Error: Version must be in X.Y.Z format"
|
echo "Error: Version must be in X.Y.Z format"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -212,16 +216,16 @@ jobs:
|
|||||||
- name: Update version in package.json
|
- name: Update version in package.json
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
pnpm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
|
pnpm version ${{ env.RESOLVED_VERSION }} --no-git-tag-version --allow-same-version
|
||||||
else
|
else
|
||||||
npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
|
npm version ${{ env.RESOLVED_VERSION }} --no-git-tag-version --allow-same-version
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Update artifacthub-pkg.yml
|
- name: Update artifacthub-pkg.yml
|
||||||
env:
|
env:
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ env.RESOLVED_VERSION }}"
|
||||||
if [ -f artifacthub-pkg.yml ]; then
|
if [ -f artifacthub-pkg.yml ]; then
|
||||||
PKG_NAME=$(grep '^name:' artifacthub-pkg.yml | cut -d: -f2 | tr -d ' "')
|
PKG_NAME=$(grep '^name:' artifacthub-pkg.yml | cut -d: -f2 | tr -d ' "')
|
||||||
else
|
else
|
||||||
@@ -276,7 +280,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare release tarball
|
- name: Prepare release tarball
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ env.RESOLVED_VERSION }}"
|
||||||
if [ -f artifacthub-pkg.yml ]; then
|
if [ -f artifacthub-pkg.yml ]; then
|
||||||
PKG_NAME=$(grep '^name:' artifacthub-pkg.yml | cut -d: -f2 | tr -d ' "')
|
PKG_NAME=$(grep '^name:' artifacthub-pkg.yml | cut -d: -f2 | tr -d ' "')
|
||||||
else
|
else
|
||||||
@@ -311,7 +315,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_RELEASE_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_RELEASE_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ env.RESOLVED_VERSION }}"
|
||||||
BRANCH="release/v${VERSION}"
|
BRANCH="release/v${VERSION}"
|
||||||
if git ls-remote --exit-code origin "refs/heads/$BRANCH" 2>/dev/null; then
|
if git ls-remote --exit-code origin "refs/heads/$BRANCH" 2>/dev/null; then
|
||||||
echo "::notice::Branch $BRANCH already exists — deleting for clean re-trigger."
|
echo "::notice::Branch $BRANCH already exists — deleting for clean re-trigger."
|
||||||
@@ -329,7 +333,7 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.GITEA_RELEASE_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_RELEASE_TOKEN }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ env.RESOLVED_VERSION }}"
|
||||||
TARBALL="${{ env.TARBALL }}"
|
TARBALL="${{ env.TARBALL }}"
|
||||||
RESPONSE=$(curl -sf -X POST \
|
RESPONSE=$(curl -sf -X POST \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
@@ -363,7 +367,7 @@ jobs:
|
|||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ env.RESOLVED_VERSION }}"
|
||||||
BODY=$(printf "Automated version bump and checksum update for v%s.\n\ncc @cpfarhood" "${VERSION}")
|
BODY=$(printf "Automated version bump and checksum update for v%s.\n\ncc @cpfarhood" "${VERSION}")
|
||||||
RESPONSE=$(curl -sf -X POST \
|
RESPONSE=$(curl -sf -X POST \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
@@ -420,7 +424,7 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.GITEA_RELEASE_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_RELEASE_TOKEN }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ env.RESOLVED_VERSION }}"
|
||||||
TARBALL_CS=$(sha256sum "${{ env.TARBALL }}" | awk '{print $1}')
|
TARBALL_CS=$(sha256sum "${{ env.TARBALL }}" | awk '{print $1}')
|
||||||
TAG_CS=$(git show "v${VERSION}:artifacthub-pkg.yml" 2>/dev/null \
|
TAG_CS=$(git show "v${VERSION}:artifacthub-pkg.yml" 2>/dev/null \
|
||||||
| grep "archive-checksum" | awk '{print $2}' | sed 's/sha256://')
|
| grep "archive-checksum" | awk '{print $2}' | sed 's/sha256://')
|
||||||
|
|||||||
Reference in New Issue
Block a user