Skip to content

v1.17.0

v1.17.0 #9

name: Publish release on NPM
on:
# When manually triggered
workflow_dispatch:
inputs:
releaseName:
description: 'Release name, e.g. v1.2.3'
required: true
# When there's a release created
release:
types: [ published ]
jobs:
publish-release-on-npm:
name: Publish release on NPM
runs-on: ubuntu-latest
steps:
- name: Setup release name
run: |
if [ -z "${{ github.event.release.name }}" ]; then
echo "RELEASE_NAME=${{ github.event.inputs.releaseName }}" >> $GITHUB_ENV
else
echo "RELEASE_NAME=${{ github.event.release.name }}" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: 'backstage/.nvmrc'
cache: 'yarn'
cache-dependency-path: 'backstage/yarn.lock'
- name: Print environment
run: |
node --version
yarn --version
- name: Print release name
run: |
echo "Release name: ${RELEASE_NAME}"
- name: Install dependencies
shell: bash
working-directory: ./backstage
run: yarn --prefer-offline --frozen-lockfile
- name: lint all code
shell: bash
working-directory: ./backstage
run: yarn backstage-cli repo lint
- name: Install tooling
shell: bash
working-directory: ./backstage
run: npm install @backstage/cli -g
- name: Compile
shell: bash
working-directory: ./backstage
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn tsc
- name: Run tests
shell: bash
working-directory: ./backstage
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn test
- name: Build
shell: bash
working-directory: ./backstage
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn tsc
yarn build:all
- name: Update version of knative-event-mesh-backend plugin
shell: bash
working-directory: ./backstage/plugins/knative-event-mesh-backend
run: |
export PATH="./node_modules/.bin/:$PATH"
export RELEASE_VERSION="${RELEASE_NAME:1}"
yarn version --new-version ${RELEASE_VERSION} --no-git-tag-version
- name: Prepack knative-event-mesh-backend plugin
shell: bash
working-directory: ./backstage/plugins/knative-event-mesh-backend
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn prepack
- name: Publish knative-event-mesh-backend plugin
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: backstage/plugins/knative-event-mesh-backend
- name: Postpack knative-event-mesh-backend plugin
shell: bash
working-directory: ./backstage/plugins/knative-event-mesh-backend
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn postpack
- name: Export knative-event-mesh-backend dynamic plugin
shell: bash
working-directory: ./backstage/plugins/knative-event-mesh-backend
run: |
export PATH="./node_modules/.bin/:$PATH"
yarn export-dynamic
- name: Publish knative-event-mesh-backend dynamic plugin
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
access: public
package: backstage/plugins/knative-event-mesh-backend/dist-dynamic
- name: Post status to Slack
# Note: using env.SLACK_WEBHOOK here because secrets are not allowed in the if block.
if: ${{ env.SLACK_WEBHOOK != '' && failure()}}
uses: rtCamp/[email protected]
env:
SLACK_ICON: http://github.com/knative.png?size=48
SLACK_USERNAME: knative/release
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: knative-release
MSG_MINIMAL: 'true'
SLACK_TITLE: '${{ github.repository }} release failed'
SLACK_MESSAGE: |
View GitHub Run - https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Fail if NO-GO
if: env.current == 'false'
run: |
# When we have figured out that things are NO-GO, we intentionally fail the job
# so that the status badge shows up red and we can use the badges to create a
# releasability dashboard for all of the repos.
exit 1