fa401afecf
Split CI into parallel lint/typecheck/test jobs with build gating on all three. Add JUnit test reporter for PR visibility. Bump Node 20 to 22. Replace inline npx commands with npm run scripts. Add CI gate and concurrency control to Release workflow. Harden tarball validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
130 lines
4.0 KiB
YAML
130 lines
4.0 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version to release (without v prefix, e.g., 0.2.0)'
|
|
required: true
|
|
type: string
|
|
|
|
concurrency:
|
|
group: release
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
- run: npm ci
|
|
- run: npm run lint
|
|
- run: npm run tsc
|
|
- run: npm test
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: [ci]
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Validate version format
|
|
run: |
|
|
if ! echo "${{ inputs.version }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
echo "::error::Version must be in format X.Y.Z (e.g., 0.2.0)"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Configure git
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Update package.json version
|
|
run: |
|
|
jq --arg version "${{ inputs.version }}" '.version = $version' package.json > package.json.tmp
|
|
mv package.json.tmp package.json
|
|
|
|
- name: Update artifacthub-pkg.yml version and URL
|
|
run: |
|
|
VERSION="${{ inputs.version }}"
|
|
RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/headlamp-tns-csi-plugin-${VERSION}.tar.gz"
|
|
|
|
sed -i "s|^version:.*|version: \"${VERSION}\"|" artifacthub-pkg.yml
|
|
sed -i "s|headlamp/plugin/archive-url:.*|headlamp/plugin/archive-url: \"${RELEASE_URL}\"|" artifacthub-pkg.yml
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build plugin
|
|
run: npm run build
|
|
|
|
- name: Package plugin
|
|
run: npx @kinvolk/headlamp-plugin package
|
|
|
|
- name: Validate tarball
|
|
run: |
|
|
EXPECTED="headlamp-tns-csi-plugin-${{ inputs.version }}.tar.gz"
|
|
if [ ! -f "$EXPECTED" ]; then
|
|
echo "::error::Expected tarball not found: $EXPECTED"
|
|
exit 1
|
|
fi
|
|
echo "Tarball validated: $EXPECTED"
|
|
|
|
- name: Compute checksum
|
|
id: compute_checksum
|
|
run: |
|
|
TARBALL="headlamp-tns-csi-plugin-${{ inputs.version }}.tar.gz"
|
|
CHECKSUM=$(sha256sum "$TARBALL" | awk '{print $1}')
|
|
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT
|
|
echo "Checksum: sha256:${CHECKSUM}"
|
|
|
|
- name: Update checksum in metadata
|
|
run: |
|
|
CHECKSUM="${{ steps.compute_checksum.outputs.checksum }}"
|
|
sed -i "s|headlamp/plugin/archive-checksum:.*|headlamp/plugin/archive-checksum: \"sha256:${CHECKSUM}\"|" artifacthub-pkg.yml
|
|
|
|
- name: Commit version bump and metadata
|
|
run: |
|
|
git add package.json artifacthub-pkg.yml
|
|
git commit -m "chore: release v${{ inputs.version }}"
|
|
git push origin main
|
|
|
|
- name: Create and push tag
|
|
run: |
|
|
git tag "v${{ inputs.version }}"
|
|
git push origin "v${{ inputs.version }}"
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: "v${{ inputs.version }}"
|
|
files: headlamp-tns-csi-plugin-${{ inputs.version }}.tar.gz
|
|
fail_on_unmatched_files: true
|
|
draft: false
|
|
prerelease: false
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Summary
|
|
run: |
|
|
echo "Version bumped to ${{ inputs.version }}"
|
|
echo "Metadata updated with checksum sha256:${{ steps.compute_checksum.outputs.checksum }}"
|
|
echo "Tag v${{ inputs.version }} created"
|
|
echo "GitHub release published with tarball"
|