v6.4.2 #415
Workflow file for this run
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: π Publish Release Candidate | |
on: | |
push: | |
branches: ['release/**'] | |
# We don't want this to run on release | |
tags-ignore: ['v**'] | |
# No need to run on docs-only changes | |
paths-ignore: ['docs/**'] | |
# Cancel in-progress runs of this workflow. | |
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-git-tags: | |
name: π· Check git tags | |
if: github.repository == 'redwoodjs/redwood' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Required because lerna uses tags to determine the version. | |
with: | |
fetch-depth: 0 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: π· Check git tags | |
run: | | |
CURRENT_TAG=$(git describe --abbrev=0) | |
# `github.ref_name` is something like `release/minor/v1.1.0`. | |
# `basename` gets us `v1.1.0`, then parameter expansion strips the `v`. | |
# See https://stackoverflow.com/questions/6594085/remove-first-character-of-a-string-in-bash. | |
BRANCH_TAG=$(basename ${{ github.ref_name }}) | |
echo | |
echo "Current tag is $CURRENT_TAG" | |
echo "Branch tag is $BRANCH_TAG" | |
echo "Comparing tags with \"yarn dlx semver-compare-cli $CURRENT_TAG lt $BRANCH_TAG\"" | |
echo | |
# See if the current tag is less than the branch's tag. | |
# If it is, we're good to keep going. | |
yarn dlx semver-compare-cli $CURRENT_TAG lt $BRANCH_TAG | |
publish-release-candidate: | |
name: π’ Publish Release Candidate | |
needs: check-git-tags | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.get-version.outputs.value }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# `fetch-depth`βnumber of commits to fetch. `0` fetches all history for all branches and tags. | |
# This is required because lerna uses tags to determine the version. | |
fetch-depth: 0 | |
- name: β¬’ Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: π Set up yarn cache | |
uses: ./.github/actions/set-up-yarn-cache | |
- name: π Yarn install | |
run: yarn install --inline-builds | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: β Check constraints, dependencies, and package.json's | |
uses: ./tasks/check | |
- name: π Build | |
run: yarn build | |
- name: π Lint | |
run: yarn lint | |
- name: π§ͺ Test | |
run: yarn test | |
- name: π’ Publish | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc | |
SEMVER=$(basename $(dirname ${{ github.ref_name }})) | |
yarn lerna publish pre$SEMVER --include-merged-tags \ | |
--exact \ | |
--canary \ | |
--preid rc \ | |
--dist-tag rc \ | |
--force-publish \ | |
--loglevel verbose \ | |
--no-git-reset \ | |
--yes | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- name: π· Get version | |
id: get-version | |
uses: sergeysova/jq-action@v2.3.0 | |
with: | |
cmd: 'jq .version packages/core/package.json -r' | |
message-slack: | |
name: π¬ Message Slack | |
needs: publish-release-candidate | |
if: ${{ !cancelled() }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: π¬ Message Slack | |
uses: ./.github/actions/message_slack_publishing | |
with: | |
title: "π RC Packages" | |
status: ${{ needs.publish-release-candidate.result }} | |
version: ${{ needs.publish-release-candidate.outputs.version }} | |
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_PACKAGE_PUBLISHING }} |