mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
* ci: add package version check (#396) * ci: add package version check Signed-off-by: Andy Lee <andy.lee@suse.com> * ci: extract check version in a script Signed-off-by: Andy Lee <andy.lee@suse.com> * ci: update env variable Signed-off-by: Andy Lee <andy.lee@suse.com> --------- Signed-off-by: Andy Lee <andy.lee@suse.com> (cherry picked from commit c541f81dc3b333e75f3b784c706210026029bc2c) # Conflicts: # .github/workflows/build-standalone-on-release.yaml * fix: conflict Signed-off-by: Andy Lee <andy.lee@suse.com> --------- Signed-off-by: Andy Lee <andy.lee@suse.com> Co-authored-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
parent
4a4f2c96bb
commit
59c63c8d9e
@ -11,18 +11,19 @@ defaults:
|
||||
working-directory: ./
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
check-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run tests
|
||||
uses: ./.github/actions/lint
|
||||
- name: Check package version
|
||||
env:
|
||||
TAG_VERSION: ${{ github.event.release.tag_name }}
|
||||
run: ./scripts/check-version.sh $TAG_VERSION
|
||||
|
||||
build-and-push-extension-catalog:
|
||||
needs: lint
|
||||
needs: check-version
|
||||
uses: ./.github/workflows/build-extension-catalog.yml
|
||||
permissions:
|
||||
actions: write
|
||||
|
||||
15
.github/workflows/build-extension-on-release.yml
vendored
15
.github/workflows/build-extension-on-release.yml
vendored
@ -29,19 +29,20 @@ jobs:
|
||||
else
|
||||
echo "Error: invalid tag format." && exit 1
|
||||
fi
|
||||
lint:
|
||||
check-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Check package version
|
||||
env:
|
||||
TAG_VERSION: ${{ github.event.release.tag_name }}
|
||||
run: ./scripts/check-version.sh $TAG_VERSION
|
||||
|
||||
- name: Run tests
|
||||
uses: ./.github/actions/lint
|
||||
build-extension-charts:
|
||||
needs:
|
||||
- setup-release-tag
|
||||
- lint
|
||||
- check-version
|
||||
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
|
||||
permissions:
|
||||
actions: write
|
||||
|
||||
@ -5,14 +5,20 @@ on:
|
||||
- v[1-9].*
|
||||
|
||||
jobs:
|
||||
build-validation:
|
||||
name: Build Test
|
||||
uses: ./.github/workflows/run-lint.yaml
|
||||
check-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Check package version
|
||||
env:
|
||||
TAG_VERSION: ${{github.ref_name}}
|
||||
run: ./scripts/check-version.sh $TAG_VERSION
|
||||
|
||||
build:
|
||||
name: Build and Upload Package
|
||||
uses: ./.github/workflows/build-and-publish-standalone.yaml
|
||||
needs:
|
||||
- build-validation
|
||||
needs: check-version
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
23
scripts/check-version.sh
Executable file
23
scripts/check-version.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
TAG_VERSION=$1
|
||||
|
||||
if [[ -z "$TAG_VERSION" ]]; then
|
||||
echo "No tag version provided"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(jq -r .version package.json)
|
||||
EXTENSION_VERSION=$(jq -r .version pkg/harvester/package.json)
|
||||
PKG_VERSION="v${EXTENSION_VERSION}"
|
||||
|
||||
if [[ "$VERSION" != "$EXTENSION_VERSION" ]]; then
|
||||
echo "Package version mismatch: $VERSION vs $EXTENSION_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${TAG_VERSION}" != "$PKG_VERSION" ]]; then
|
||||
echo "Package version $PKG_VERSION in pkg/harvester/package.json does not match tag version ${TAG_VERSION}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Package version and tag version match: ${TAG_VERSION}"
|
||||
Loading…
x
Reference in New Issue
Block a user