prepare for new release (#3680) #2743
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: | |
# Default branch is meant for standard releases, i.e. minor version bumps (e.g. 1.6.0, 1.7.0) | |
- master | |
# Release branches are meant for recovery releases, i.e. patch version bumps (e.g. 1.6.1, 1.7.1) | |
- 'release/**' | |
# This job is shared by both standard and recovery release processes | |
# See https://github.com/finos/legend-studio/blob/master/docs/workflow/release-process.md | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest-4-cores | |
if: github.repository == 'finos/legend-studio' # prevent running this action in forks | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
with: | |
# fetch all Git history so that `changesets` can generate changelogs with the correct commits | |
fetch-depth: 0 | |
- name: Get Yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Setup Yarn cache | |
uses: actions/[email protected] | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: ${{ runner.os }}-yarn- | |
- name: Setup Node | |
uses: actions/[email protected] | |
with: | |
node-version: 21 | |
- name: Install dependencies | |
run: yarn | |
- name: Generate new release PR title | |
id: generate-new-release-pr-title | |
env: | |
MAIN_PACKAGE: '@finos/legend-application-studio-bootstrap' | |
run: node ./scripts/release/createNewReleasePRTitle.js | |
- name: Create new release pull request or Publish to NPM | |
id: changesets | |
uses: changesets/[email protected] | |
with: | |
version: yarn release:version | |
commit: 'chore: bump versions and release' | |
title: ${{ steps.generate-new-release-pr-title.outputs.title }} | |
publish: yarn release | |
createGithubReleases: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Prevent `changeset`'s default behavior to create Git tags and publish Github release | |
# | |
# Conclude the release with the following actions: | |
# 1. Create a tag for the release and publish a Github release for that tag | |
# 2. Create the release branch for the latest release tag | |
# 3. Create a new release milestone and move over open issues in the current milestone and close the current milestone. | |
# See https://github.com/finos/legend-studio/blob/master/docs/workflow/release-process.md | |
- name: Conclude new release | |
if: steps.changesets.outputs.published == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MAIN_PACKAGE: '@finos/legend-application-studio-bootstrap' | |
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} | |
run: node ./scripts/release/concludeNewRelease.js | |
- name: Login to Docker Hub | |
if: steps.changesets.outputs.published == 'true' | |
uses: docker/login-action@v3 | |
with: | |
username: finos | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Publish to Docker | |
# NOTE: we enforce this condition because publishing `@finos/legend-application-studio-deployment` should only | |
# be attempted if other packages are published, to ensure it uses the latest tagged versions | |
# for all of its dependencies instead of their snapshots. | |
# | |
# This change has some limtation in that, if somehow Docker publish step failed, there is | |
# no quick way to rerun this step, but to do a bump in a dependent modules (e.g. | |
# `@finos/legend-application-studio` in order to trigger a version bump in `@finos/legend-application-studio-deployment` | |
if: steps.changesets.outputs.published == 'true' | |
run: | | |
yarn workspace @finos/legend-application-studio-deployment publish:docker | |
yarn workspace @finos/legend-application-query-deployment publish:docker | |
yarn workspace @finos/legend-server-showcase-deployment publish:docker | |
env: | |
# TODO: After https://github.com/finos/legend-studio/pull/227 it seems like due to either | |
# the upgrade of Webpack/Typescript that we start seeing some OOM when building Webpack | |
# while publishing to Docker. We should once in a while remove this line and try again. | |
NODE_OPTIONS: '--max-old-space-size=4096' | |
- name: Upload publish content | |
# If publish never happened, there's no point in uploading this content | |
if: steps.changesets.outputs.published == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: publish-content | |
path: packages/*/build/publishContent/package.json |