Skip to content

Commit

Permalink
[backport v2.8.next1] Update publish shell workflow to allow for inde…
Browse files Browse the repository at this point in the history
…pendent release of either shell or creators packages (#11738)

* backport of PR 11697 + tag to publish both shell and creator

* fix publish shell

* fix tag to v1

* update npm tag to legacy-v1 + add version check for pre-release

* Ensure @rancher/shell version using tags (#11758)

* Ensure @rancher/shell version using tags

Enable corepack for extension builds

Migrate creators outside of shell dir

Update creators path - switch to npm publish

* Add NPM_REGISTRY to publish args

* Fix creators_dir path - Bump ext package

* Add update package version function in test script

* Fix gitignore file name

* Add .yarnrc.yml for skeleton - revert node versions

* Remove shell creators

* Update publish-shell workflow with corepack (#11820)

* Bump extension creator - Bump shell

* Add NPM_TAG to publish-shell script

* Remove unnecessary tag addition

* Fix publish_args declaration and tag addition

* Add step to setup node prior to corepack enable

* Skip validate plugin build step due to node version mismatch

---------

Co-authored-by: Jordon Leach <[email protected]>
Co-authored-by: Jordon Leach <[email protected]>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent de683da commit 9902250
Show file tree
Hide file tree
Showing 42 changed files with 1,075 additions and 409 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/build-extension-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Configure Git
run: |
Expand Down Expand Up @@ -58,26 +61,20 @@ jobs:
- name: Setup Nodejs and npm
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: "16"

- name: Setup yarn
run: npm install -g yarn

- name: Setup Nodejs with yarn caching
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn

- name: Install dependencies
run: yarn

- name: Build and push UI image
run: |
publish="yarn publish-pkgs -cp -r ${{ inputs.registry_target }} -o ${{ github.repository_owner }}"
if [[ -n "${{ inputs.tagged_release }}" ]]; then
publish="$publish -t ${{ inputs.tagged_release }}"
fi
$publish
20 changes: 8 additions & 12 deletions .github/workflows/build-extension-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ jobs:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Enable Corepack
run: corepack enable

- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
Expand All @@ -53,17 +56,11 @@ jobs:
- name: Setup Nodejs and npm
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: "16"

- name: Setup yarn
run: npm install -g yarn

- name: Setup Nodejs with yarn caching
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn

- name: Install dependencies
run: yarn

Expand All @@ -76,7 +73,7 @@ jobs:
if [[ -n "${{ inputs.tagged_release }}" ]]; then
publish="$publish -t ${{ inputs.tagged_release }}"
fi
$publish
- name: Upload charts artifact
Expand All @@ -98,7 +95,7 @@ jobs:
pages: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: "${{ inputs.target_branch }}"

Expand All @@ -123,6 +120,5 @@ jobs:
with:
charts_dir: ./charts/*
env:
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_SKIP_EXISTING: true

23 changes: 14 additions & 9 deletions .github/workflows/check-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '16.20.2'
- name: Validate Plugin build system
run: ./shell/scripts/test-plugins-build.sh
shell: bash
- name: Checkout
uses: actions/checkout@v4

- name: Enable Corepack
run: corepack enable

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "16.20.2"
cache: "yarn"

- name: Validate Plugin build system
run: ./shell/scripts/test-plugins-build.sh
shell: bash
61 changes: 61 additions & 0 deletions .github/workflows/release-shell-pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish Shell Package

on:
push:
tags:
- "shell-pkg-v*"
- "creators-pkg-v*"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
cache: 'yarn'

- name: Check Tags Version Matching
env:
TAG: ${{github.ref_name}}
run: ./.github/workflows/scripts/check-package-tag-version.sh
shell: bash

# Skipping due to node version mismatch
# - name: Validate Plugin build system
# run: ./shell/scripts/test-plugins-build.sh
# shell: bash

# Reset the local (ci) repository state because
# The previous step (Validate Plugin build system) changes
# the version number on package.json for Shell in order
# to release it in verdaccio for it's tests
- name: Reset repository (file system)
run: |
git reset --hard HEAD
echo $NPM_REGISTRY
cat ./shell/package.json
- uses: actions/setup-node@v4
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
scope: "@rancher"

- name: Install packages
run: yarn install --frozen-lockfile

- name: Publish Shell Package to npm
run: ./shell/scripts/publish-shell.sh --npm
env:
TAG: ${{github.ref_name}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/scripts/check-package-tag-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
echo "Checking package tag version matching"

SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
BASE_DIR="$(
cd $SCRIPT_DIR && cd ../.. &
pwd
)"
SHELL_DIR=$BASE_DIR/shell
CREATORS_DIR=$BASE_DIR/creators/extension

echo "TAG ${TAG}"

# let's get the package name and version from the tag
PKG_NAME=$(sed 's/-pkg-v.*//' <<< "$TAG")
PKG_VERSION=$(sed 's/.*-pkg-v//'<<< "$TAG")

echo "PKG_NAME ${PKG_NAME}"
echo "PKG_VERSION ${PKG_VERSION}"

# version comparison checks
case $PKG_NAME in
"shell")
SHELL_VERSION=$(jq -r .version ${SHELL_DIR}/package.json)
if [ "$SHELL_VERSION" == "$PKG_VERSION" ]; then
echo "tag check: shell versions match"
exit 0
else
echo "Version mismatch for the shell package publish => shell: ${SHELL_VERSION} vs tag: ${PKG_VERSION}. Please redo the tagging properly"
exit 1
fi
;;
"creators")
CREATORS_VERSION=$(jq -r .version ${CREATORS_DIR}/package.json)
if [ "$CREATORS_VERSION" == "$PKG_VERSION" ]; then
echo "tag check: creators versions match"
exit 0
else
echo "Version mismatch for the creators package publish => creators: ${CREATORS_VERSION} vs tag: ${PKG_VERSION}. Please redo the tagging properly"
exit 1
fi
;;
*)
echo "something went wrong with the tagging or versioning => TAG: ${TAG} , PKG_NAME: ${PKG_NAME}, PKG_VERSION: ${PKG_VERSION}"
exit 1
;;
esac
30 changes: 30 additions & 0 deletions creators/extension/app/app.package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "NAME",
"version": "0.1.0",
"private": false,
"engines": {
"node": ">=16"
},
"dependencies": {
"cache-loader": "^4.1.0",
"color": "4.2.3",
"ip": "2.0.1",
"node-polyfill-webpack-plugin": "^3.0.0"
},
"resolutions": {
"d3-color": "3.1.0",
"ejs": "3.1.9",
"follow-redirects": "1.15.2",
"glob": "7.2.3",
"glob-parent": "6.0.2",
"json5": "2.2.3",
"@types/lodash": "4.17.5",
"merge": "2.1.1",
"node-forge": "1.3.1",
"nth-check": "2.1.1",
"qs": "6.11.1",
"roarr": "7.0.4",
"semver": "7.5.4",
"@vue/cli-service/html-webpack-plugin": "^5.0.0"
}
}
File renamed without changes.
Loading

0 comments on commit 9902250

Please sign in to comment.