feat(#2291): create major release #1
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: Alpha Dry-Run Release CI | |
on: | |
push: | |
branches: | |
- alpha-dry-run-release | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
- run: npm ci | |
- name: Get last successful commit | |
uses: nrwl/nx-set-shas@v3 | |
id: last_successful_commit | |
with: | |
main-branch-name: alpha | |
- name: Lint | |
run: npm run lint | |
- name: Test | |
run: npm run test | |
- name: Build | |
run: npx nx run-many --target=build --all --prod --exclude=angular,react,angular-tests,angular-tests-e2e | |
- name: Update Web components documentation | |
run: cp libs/web-components/README.md dist/libs/web-components | |
- name: Remove types file for now | |
run: rm dist/libs/web-components/index.d.ts | |
- name: Release (Dry-Run) and Extract Next Version | |
id: release_dry_run | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
# Run dry-run and capture logs while printing everything | |
OUTPUT=$(npx nx affected --target=release --base=${{ steps.last_successful_commit.outputs.base }} -- --dry-run | tee /dev/tty) | |
# Extract the version from logs | |
NEXT_VERSION=$(echo "$OUTPUT" | grep -oE 'The next release version is [0-9]+\.[0-9]+\.[0-9]+' | awk '{print $6}') | |
# Print and save the next version | |
echo "🚀 Next Version: $NEXT_VERSION" | |
echo "next_version=$NEXT_VERSION" >> $GITHUB_ENV | |
- name: Display Next Version | |
run: echo "🚀 The next version will be ${{ env.next_version }} |