Merge pull request #1169 from takenspc/task/1168-normalize-whitespace #465
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: Release | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
check-next-version: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16] | |
outputs: | |
next_version: ${{ steps.versionCheck.outputs.next_version }} | |
current_version: ${{ steps.versionCheck.outputs.current_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
id: cache-node-modules | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
./packages/*/node_modules | |
key: ${{ runner.os }}-${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('./packages/*/package-lock.json') }}-${{ hashFiles('./package-lock.json') }} | |
- name: Install Dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: | | |
npm ci --ignore-scripts | |
- id: versionCheck | |
run: | | |
echo "next_version=$(node ./bin/print-next-version.js)" >> $GITHUB_OUTPUT | |
echo "current_version=$(node ./bin/print-latest-version.js)" >> $GITHUB_OUTPUT | |
publish: | |
runs-on: ubuntu-latest | |
needs: [check-next-version] | |
if: ${{ needs.check-next-version.outputs.next_version != needs.check-next-version.outputs.current_version }} | |
strategy: | |
matrix: | |
node-version: [16] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
id: cache-node-modules | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
./packages/*/node_modules | |
key: ${{ runner.os }}-${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('./packages/*/package-lock.json') }}-${{ hashFiles('./package-lock.json') }} | |
- name: Cache turbo build setup | |
uses: actions/cache@v3 | |
with: | |
path: .turbo | |
key: turbo-master-${{ github.sha }} | |
restore-keys: | | |
turbo-master | |
- name: Install Dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: | | |
npm ci --ignore-scripts | |
- name: Set version | |
run: node ./bin/set-version.js --version=${{needs.check-next-version.outputs.next_version }} | |
- name: Compile packages | |
run: npm run compile | |
- name: Run tests | |
run: npm run test | |
- name: Configures Git | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "$(git log --format='%ae' HEAD^!)" | |
- name: Creates release branch | |
run: | | |
git checkout -b release/${{ needs.check-next-version.outputs.next_version }} origin/master | |
git push origin release/${{ needs.check-next-version.outputs.next_version }} | |
- name: Pushes Git tag | |
run: | | |
git tag --force v${{ needs.check-next-version.outputs.next_version }} ${GITHUB_SHA} | |
git push origin --tags | |
- name: Set .npmrc for publish | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" > ./.npmrc | |
npm whoami | |
- name: Publish packages | |
run: npm publish --workspaces | |
create-release: | |
runs-on: ubuntu-latest | |
needs: [publish, check-next-version] | |
strategy: | |
matrix: | |
node-version: [16] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
id: cache-node-modules | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
./packages/*/node_modules | |
key: ${{ runner.os }}-${{ matrix.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('./packages/*/package-lock.json') }}-${{ hashFiles('./package-lock.json') }} | |
- name: Install Dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: | | |
npm ci --ignore-scripts | |
- run: node ./bin/generate-release-notes.js --latest-version=${{needs.check-next-version.outputs.current_version}} --next-version=${{needs.check-next-version.outputs.next_version}} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ needs.check-next-version.outputs.next_version }} | |
release_name: v${{ needs.check-next-version.outputs.next_version }} | |
body_path: ./RELEASE_NOTES.md | |
draft: false | |
prerelease: false |