Merge PR #6
* ci: switch to org-level reusable workflows * chore: retrigger CI after reusable workflows merged * feat: add workflow_dispatch to CI workflow --------- Co-authored-by: gandalf-the-greybeard[bot] <gandalf-the-greybeard[bot]@users.noreply.github.com> Co-authored-by: hugh-hackman[bot] <266376744+hugh-hackman[bot]@users.noreply.github.com> Co-authored-by: hugh-hackman[bot] <hugh-hackman[bot]@users.noreply.github.com>
This commit was merged in pull request #6.
This commit is contained in:
committed by
GitHub
parent
91e1cbd618
commit
dbbabef94a
@@ -5,37 +5,9 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
runs-on: local-ubuntu-latest
|
uses: privilegedescalation/.github/.github/workflows/plugin-ci.yaml@main
|
||||||
timeout-minutes: 10
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- 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: npx @kinvolk/headlamp-plugin build
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
run: npm run lint
|
|
||||||
|
|
||||||
- name: Type-check
|
|
||||||
run: npm run tsc
|
|
||||||
|
|
||||||
- name: Format check
|
|
||||||
run: npm run format:check
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: npm test
|
|
||||||
|
|||||||
@@ -11,110 +11,9 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: release
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
|
||||||
uses: ./.github/workflows/ci.yaml
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: ci
|
uses: privilegedescalation/.github/.github/workflows/plugin-release.yaml@main
|
||||||
runs-on: local-ubuntu-latest
|
with:
|
||||||
timeout-minutes: 10
|
version: ${{ inputs.version }}
|
||||||
|
upstream-repo: fenio/tns-csi
|
||||||
steps:
|
|
||||||
- name: Validate version format
|
|
||||||
run: |
|
|
||||||
if [[ ! "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
||||||
echo "Error: Version must be in X.Y.Z format"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Configure Git
|
|
||||||
run: |
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
|
|
||||||
- name: Update version in package.json
|
|
||||||
run: npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
|
|
||||||
|
|
||||||
- name: Update artifacthub-pkg.yml
|
|
||||||
run: |
|
|
||||||
VERSION="${{ inputs.version }}"
|
|
||||||
PKG_NAME=$(jq -r .name package.json)
|
|
||||||
RELEASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/${PKG_NAME}-${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: Update appVersion from latest tns-csi release
|
|
||||||
run: |
|
|
||||||
APP_VERSION=$(curl -sf https://api.github.com/repos/fenio/tns-csi/releases/latest | jq -r '.tag_name | ltrimstr("v")')
|
|
||||||
if [ -z "$APP_VERSION" ] || [ "$APP_VERSION" = "null" ]; then
|
|
||||||
echo "::warning::Could not fetch latest tns-csi release, skipping appVersion update"
|
|
||||||
else
|
|
||||||
sed -i "s|^appVersion:.*|appVersion: \"${APP_VERSION}\"|" artifacthub-pkg.yml
|
|
||||||
echo "appVersion set to ${APP_VERSION}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build plugin
|
|
||||||
run: npx @kinvolk/headlamp-plugin build
|
|
||||||
|
|
||||||
- name: Package plugin
|
|
||||||
run: npx @kinvolk/headlamp-plugin package
|
|
||||||
|
|
||||||
- name: Prepare release tarball
|
|
||||||
run: |
|
|
||||||
VERSION="${{ inputs.version }}"
|
|
||||||
PKG_NAME=$(jq -r .name package.json)
|
|
||||||
TARBALL="${PKG_NAME}-${VERSION}.tar.gz"
|
|
||||||
# Rename tarball if headlamp-plugin produced a different name
|
|
||||||
for f in *.tar.gz; do
|
|
||||||
[ "$f" != "$TARBALL" ] && mv "$f" "$TARBALL"
|
|
||||||
done
|
|
||||||
echo "TARBALL=$TARBALL" >> $GITHUB_ENV
|
|
||||||
echo "PKG_NAME=$PKG_NAME" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Validate tarball
|
|
||||||
run: |
|
|
||||||
echo "Tarball: ${{ env.TARBALL }}"
|
|
||||||
ls -lh "${{ env.TARBALL }}"
|
|
||||||
tar -tzf "${{ env.TARBALL }}" | head -20
|
|
||||||
tar -tzf "${{ env.TARBALL }}" | grep -q "main.js" || { echo "Error: main.js not found in tarball"; exit 1; }
|
|
||||||
|
|
||||||
- name: Compute checksum
|
|
||||||
run: |
|
|
||||||
CHECKSUM=$(sha256sum "${{ env.TARBALL }}" | awk '{print $1}')
|
|
||||||
echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
|
|
||||||
sed -i "s|headlamp/plugin/archive-checksum:.*|headlamp/plugin/archive-checksum: sha256:${CHECKSUM}|" artifacthub-pkg.yml
|
|
||||||
|
|
||||||
- name: Commit and tag
|
|
||||||
run: |
|
|
||||||
VERSION="${{ inputs.version }}"
|
|
||||||
git add package.json package-lock.json artifacthub-pkg.yml
|
|
||||||
git commit -m "release: v${VERSION}"
|
|
||||||
git tag "v${VERSION}"
|
|
||||||
git push origin main --tags
|
|
||||||
|
|
||||||
- name: Create GitHub Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
tag_name: "v${{ inputs.version }}"
|
|
||||||
files: ${{ env.TARBALL }}
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
generate_release_notes: true
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user