Skip to content

On merge to develop (alpha releases) #5

On merge to develop (alpha releases)

On merge to develop (alpha releases) #5

# Inspired from https://github.com/backstage/backstage/blob/master/.github/workflows/ci.yml. Thanks!
name: On merge to develop (alpha releases)
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- "packages/**"
- "!packages/**/CHANGELOG.md" # filters out changes made by lerna
- "!packages/**/package.json" # filters out changes made by lerna
- ".github/workflows/build.yml"
defaults:
run:
shell: bash
jobs:
quality-checks:
uses: ./.github/workflows/reusable-quality-checks.yml
load-nodejs-supported-versions:
uses: ./.github/workflows/reusable-load-nodejs-supported-versions.yml
# We test the current LTS on all OSes and other supported versions are only tested on Ubuntu for performance reasons
# All the other os/version tuples will be tested in the post-release E2E workflow
tests-per-nodejs-version:
needs: load-nodejs-supported-versions
strategy:
matrix:
node-version: ${{ fromJson(needs.load-nodejs-supported-versions.outputs.node_versions) }}
uses: ./.github/workflows/reusable-tests.yml
with:
os: ubuntu-latest
node-version: ${{ matrix.node-version }}
tests-LTS-per-other-os:
strategy:
matrix:
os: [windows-latest, macos-latest]
uses: ./.github/workflows/reusable-tests.yml
with:
os: ${{ matrix.os }}
node-version-file: .nvmrc # current LTS
tests-nodejs-current:
uses: ./.github/workflows/reusable-tests.yml
with:
os: ubuntu-latest
node-version: current
experimental: true # best effort mode
publish-pages:
needs:
- quality-checks
- tests-per-nodejs-version
- tests-LTS-per-other-os
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false # required by JamesIves/github-pages-deploy-action
fetch-depth: 0 # required by Log4brains to work correctly (needs the whole Git history)
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc # current LTS
cache: yarn
cache-dependency-path: yarn.lock
- run: yarn install --frozen-lockfile
- name: Build and link
run: |
yarn build
yarn link-cli
echo "$(yarn global bin)" >> $GITHUB_PATH
- name: Log4brains build
env:
HIDE_LOG4BRAINS_VERSION: "1" # TODO: use lerna to bump the version temporarily here so we don't have to hide it
run: log4brains build --basePath /${GITHUB_REPOSITORY#*/}/adr
- name: Publish to Github pages
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: .log4brains/out
TARGET_FOLDER: adr
release-alpha:
needs: publish-pages # we could perform this step in parallel but this acts as a last end-to-end test before releasing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for Lerna (https://stackoverflow.com/a/60184319/9285308)
ssh-key: ${{ secrets.LERNA_GITHUB_DEPLOY_KEY }} # so that Lerna is able to push to the protected branch (https://github.com/orgs/community/discussions/25305#discussioncomment-10728028)
- name: Fetch all git tags for Lerna # (https://stackoverflow.com/a/60184319/9285308)
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc # current LTS
cache: yarn
cache-dependency-path: yarn.lock
registry-url: https://registry.npmjs.org/ # needed by lerna to push to NPM
- run: yarn install --frozen-lockfile
- run: yarn build
- name: Git identity for github-actions[bot]
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Run lerna publish
run: yarn lerna publish --yes --conventional-commits --conventional-prerelease --force-publish --dist-tag alpha --exact --create-release github
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}