From 80de39908f4e3d5b25566060e5a8a4e155583a3c Mon Sep 17 00:00:00 2001 From: Rob Reed Date: Mon, 24 Nov 2025 18:19:54 -0800 Subject: [PATCH] [XELP] GHA shadow release --- .github/workflows/xelp_shadow_release.yml | 72 +++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/xelp_shadow_release.yml diff --git a/.github/workflows/xelp_shadow_release.yml b/.github/workflows/xelp_shadow_release.yml new file mode 100644 index 0000000..de356ce --- /dev/null +++ b/.github/workflows/xelp_shadow_release.yml @@ -0,0 +1,72 @@ +name: Xelp Shadow Release + +on: + workflow_dispatch: + +jobs: + shadow-release: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout xelp/main + uses: actions/checkout@v3.5.3 + with: + ref: xelp/main + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v3.8.1 + with: + node-version: '18' + + - name: Configure Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + - name: Calculate XelpShadow Version + id: version + run: | + CURRENT_VERSION=$(node -p "require('./package.json').version") + echo "Current version: $CURRENT_VERSION" + + # Remove pre-release and build metadata + BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/[-+].*//') + + # Split version into parts + IFS='.' read -r -a PARTS <<< "$BASE_VERSION" + MAJOR="${PARTS[0]}" + MINOR="${PARTS[1]}" + PATCH="${PARTS[2]}" + + # Add 100 to major version + NEW_MAJOR=$((MAJOR + 100)) + + # Get build metadata + COMMIT_COUNT=$(git rev-list --count HEAD) + SHORT_HASH=$(git rev-parse --short HEAD) + + SHADOW_VERSION="$NEW_MAJOR.$MINOR.$PATCH-xelp+$COMMIT_COUNT.$SHORT_HASH" + + echo "Shadow version: $SHADOW_VERSION" + echo "shadow_version=$SHADOW_VERSION" >> $GITHUB_OUTPUT + + - name: Update package.json version + run: | + npm version ${{ steps.version.outputs.shadow_version }} --no-git-tag-version + + - name: Install dependencies and Build + run: | + npm ci + npm run build + + - name: Commit and Push + run: | + set -e + git checkout -b xelp/dist + git add -f dist/ package.json package-lock.json + git commit -m "Release shadow version ${{ steps.version.outputs.shadow_version }}" + git tag "v${{ steps.version.outputs.shadow_version }}" + git push origin xelp/dist --force + git push origin "v${{ steps.version.outputs.shadow_version }}"