Merge branch 'main' into feature/SWC-1.0-RC #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: RC Release | |
on: | |
push: | |
branches: | |
- feature/SWC-1.0-RC | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Set Git identity | |
run: | | |
git config --global user.email "support+actions@github.com" | |
git config --global user.name "github-actions-bot" | |
- name: Get latest published 1.0.0-rc version | |
id: get_latest_published_rc | |
run: | | |
LATEST_RC_VERSION=$(npm view @spectrum-web-components/button@1.0.0-rc version || echo "none") | |
echo "latest_rc_version=$LATEST_RC_VERSION" >> $GITHUB_OUTPUT | |
- name: Calculate next rc version | |
id: calculate_next_rc_version | |
run: | | |
BASE_VERSION="1.0.0" | |
LATEST_RC_VERSION="${{ steps.get_latest_published_rc.outputs.latest_rc_version }}" | |
if [ "$LATEST_RC_VERSION" == "none" ]; then | |
RC_VERSION="$BASE_VERSION-rc.0" | |
else | |
CURRENT_RC_NUMBER=$(echo "$LATEST_RC_VERSION" | sed 's/.*-rc\.\([0-9]\+\)/\1/') | |
NEXT_RC_NUMBER=$((CURRENT_RC_NUMBER + 1)) | |
RC_VERSION="$BASE_VERSION-rc.$NEXT_RC_NUMBER" | |
fi | |
echo "rc_version=$RC_VERSION" >> $GITHUB_OUTPUT | |
- name: Update package versions for rc release | |
run: | | |
npx lerna version "${{ steps.calculate_next_rc_version.outputs.rc_version }}" --no-git-tag-version --no-push --yes | |
- name: Configure NPM for Lerna publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Publish 1.0.0 rc release | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
git commit -am "chore: publish rc version ${{ steps.calculate_next_rc_version.outputs.rc_version }}" | |
npx lerna publish from-package --dist-tag rc --no-git-tag-version --no-push --yes |