chore: trigger ci #1
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 Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
needs_release: ${{ steps.release_check.outputs.needs_release }} | |
env: | |
CI: true | |
NODE_OPTIONS: --max-old-space-size=4096 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: yarn install --frozen-lockfile | |
- name: Fetch previous commit for release check | |
run: git fetch origin '${{ github.event.before }}' | |
- name: Check if release | |
id: release_check | |
run: node scripts/check-if-release.js | |
env: | |
COMMIT_SHA_BEFORE: '${{ github.event.before }}' | |
- name: build type declarations | |
run: yarn tsc | |
- name: build packages | |
run: yarn build | |
# A separate release build that is only run for commits that are the result of merging the "Version Packages" PR | |
# We can't re-use the output from the above step, but we'll have a guaranteed node_modules cache and | |
# only run the build steps that are necessary for publishing | |
release: | |
needs: build | |
if: needs.build.outputs.needs_release == 'true' | |
runs-on: ubuntu-latest | |
env: | |
CI: 'true' | |
NODE_OPTIONS: --max-old-space-size=4096 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: yarn install --frozen-lockfile | |
- name: build type declarations | |
run: yarn tsc | |
- name: build packages | |
run: yarn backstage-cli repo build | |
- name: 'Login to npmjs npm repo .npmrc' | |
shell: bash | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_AUTH_TOKEN}}" >> .npmrc | |
echo "_auth = ${{ secrets.NPM_CONFIG__AUTH }}" >> .npmrc | |
echo "always-auth = true" >> .npmrc | |
# Publishes current version of packages that are not already present in the registry. | |
- name: Run publish | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "roadie-bot" | |
lerna publish from-package --yes --no-verify-access | |
# Creates the next available tag with format "release-<year>-<month>-<day>[.<n>]" | |
- name: Create a release tag | |
id: create_tag | |
run: node scripts/create-release-tag.js | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Convert the newly created tag into a release with changelog information | |
- name: Create release on GitHub | |
run: node scripts/create-github-release.js ${{ steps.create_tag.outputs.tag_name }} 1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |