Publish OpenDORA Backstage Plugin NPM Package #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 OpenDORA Backstage Plugin NPM Package | |
on: | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
package: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
defaults: | |
run: | |
working-directory: backstage-plugin | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup nodejs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: "yarn" | |
cache-dependency-path: backstage-plugin/yarn.lock | |
registry-url: https://npm.pkg.github.com/ | |
always-auth: true | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Type checking and declarations | |
run: yarn tsc | |
- name: Build | |
run: yarn build:all | |
- name: Install GitVersion | |
if: github.event_name == 'pull_request' | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: "5.x" | |
preferLatestVersion: true | |
- name: Determine Version | |
if: github.event_name == 'pull_request' | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
- name: Publish PR | |
if: github.event_name == 'pull_request' | |
working-directory: backstage-plugin/plugins/open-dora | |
run: | | |
# Replace the @devoteam-nl with @devoteamnl in package.json | |
sed -i 's/"@devoteam-nl\//"@devoteamnl\//g' package.json | |
yarn version --new-version ${{ steps.gitversion.outputs.fullSemVer }} --no-git-tag-version | |
yarn publish --non-interactive --tag pr | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to GHCR | |
if: github.event_name == 'release' | |
working-directory: backstage-plugin/plugins/open-dora | |
run: | | |
# Replace the @devoteam-nl with @devoteamnl in package.json | |
sed -i 's/"@devoteam-nl\//"@devoteamnl\//g' package.json | |
yarn publish --non-interactive | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |