mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-15 14:11:46 +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>
This commit is contained in:
parent
4486f71c8f
commit
c541f81dc3
@ -11,18 +11,19 @@ defaults:
|
|||||||
working-directory: ./
|
working-directory: ./
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
check-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout repository
|
||||||
with:
|
uses: actions/checkout@v4
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Run tests
|
- name: Check package version
|
||||||
uses: ./.github/actions/lint
|
env:
|
||||||
|
TAG_VERSION: ${{ github.event.release.tag_name }}
|
||||||
|
run: ./scripts/check-version.sh $TAG_VERSION
|
||||||
|
|
||||||
build-and-push-extension-catalog:
|
build-and-push-extension-catalog:
|
||||||
needs: lint
|
needs: check-version
|
||||||
uses: ./.github/workflows/build-extension-catalog.yml
|
uses: ./.github/workflows/build-extension-catalog.yml
|
||||||
permissions:
|
permissions:
|
||||||
actions: write
|
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
|
else
|
||||||
echo "Error: invalid tag format." && exit 1
|
echo "Error: invalid tag format." && exit 1
|
||||||
fi
|
fi
|
||||||
lint:
|
check-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout repository
|
||||||
with:
|
uses: actions/checkout@v4
|
||||||
fetch-depth: 1
|
- 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:
|
build-extension-charts:
|
||||||
needs:
|
needs:
|
||||||
- setup-release-tag
|
- setup-release-tag
|
||||||
- lint
|
- check-version
|
||||||
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
|
uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master
|
||||||
permissions:
|
permissions:
|
||||||
actions: write
|
actions: write
|
||||||
|
|||||||
@ -5,9 +5,20 @@ on:
|
|||||||
- v[1-9].*
|
- v[1-9].*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
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:
|
build:
|
||||||
name: Build and Upload Package
|
name: Build and Upload Package
|
||||||
uses: ./.github/workflows/build-and-publish-standalone.yaml
|
uses: ./.github/workflows/build-and-publish-standalone.yaml
|
||||||
|
needs: check-version
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
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