Skip to content

chore(release): 14.4.0 #10

chore(release): 14.4.0

chore(release): 14.4.0 #10

# This is a workflow to create github release for a tag and publish the package
# to npm repo
name: Release and publish
# Controls when the action will run. Triggers the workflow on push of tag
# request events but only tags matching the configured regex
on:
push:
tags:
# patterns to match for tag creation. Here all tags similar to v1.0 or
# v1.2.0 will trigger this action
- 'v[0-9]+.[0-9]+.[0-9]+*'
# A workflow run is made up of one or more jobs that can run sequentially or in
# parallel
jobs:
# For more information on setting outputs and reading them have a look at
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjobs_idoutputs
setup_variables:
runs-on: ubuntu-latest
outputs:
isLatest: ${{ steps.release_type.outputs.latest }}
steps:
- id: release_type
name: Identify release type πŸ”
# For understanding how to set output read:
# https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter
run: echo "::set-output name=latest::$LATEST"
env:
LATEST: ${{ contains(github.ref, '-next') != true && contains(github.ref, '-rc') != true }}
create_release:
permissions:
contents: write # for actions/create-release to create a release
needs: [setup_variables]
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the
# job
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v4
with:
fetch-depth: 20
fetch-tags: false
- name: Create release for tag πŸ”–
uses: actions/create-release@latest
env:
# this is provided by github, you don't need to do anything here
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: Please refer to [CHANGELOG.md](https://github.com/thymikee/jest-preset-angular/blob/${{ github.ref }}/CHANGELOG.md) for details.
draft: false
prerelease: ${{ needs.setup_variables.outputs.isLatest != 'true' }}
publish_to_npm:
needs: [setup_variables, create_release]
runs-on: ubuntu-latest
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v4
with:
fetch-depth: 20
fetch-tags: false
- name: Restore cached node modules ♻️
id: cache-yarn
uses: actions/cache@v4
with:
path: |
.yarn/cache
node_modules
examples/example-app-monorepo/node_modules
examples/example-app-v17/node_modules
examples/example-app-v18/node_modules
examples/example-app-v19/node_modules
examples/example-app-yarn-workspace/node_modules
key: ${{ inputs.os }}-${{ inputs.node }}-build-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ inputs.os }}-${{ inputs.node }}-build
- name: Setup Node version βš™οΈ
uses: actions/setup-node@v4
if: ${{ steps.cache-yarn.outputs.cache-hit != 'true' }}
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install πŸ”§
if: ${{ steps.cache-yarn.outputs.cache-hit != 'true' }}
run: |
yarn --immutable
- name: Build πŸ”¨
run: yarn build
- name: Publish with latest tag πŸš€
if: ${{ needs.setup_variables.outputs.isLatest == 'true' }}
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish with next tag πŸš€
if: ${{ needs.setup_variables.outputs.isLatest != 'true' }}
run: npm publish --access public --tag next
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}