From 273e9dd9d96ff13f3f8503658d864f5495427723 Mon Sep 17 00:00:00 2001 From: Kyle Watson Date: Mon, 27 Nov 2023 15:18:31 +0100 Subject: [PATCH] ci(backstage-plugin): Publish to GHCR on release (#111) Publish to both npm and GHCR when publishing a release so that the repo registry is kept up-to-date. Remove unneeded env var from pr publish job. Addresses #61 --- .../pr-backstage-plugin-workflow.yaml | 1 - .../publish-backstage-plugin-workflow.yaml | 38 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-backstage-plugin-workflow.yaml b/.github/workflows/pr-backstage-plugin-workflow.yaml index 0efe1f8..1a4d3fe 100644 --- a/.github/workflows/pr-backstage-plugin-workflow.yaml +++ b/.github/workflows/pr-backstage-plugin-workflow.yaml @@ -90,4 +90,3 @@ jobs: yarn publish --non-interactive --tag pr env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: ${{ github.event.number }} diff --git a/.github/workflows/publish-backstage-plugin-workflow.yaml b/.github/workflows/publish-backstage-plugin-workflow.yaml index 7b074e3..5f2508c 100644 --- a/.github/workflows/publish-backstage-plugin-workflow.yaml +++ b/.github/workflows/publish-backstage-plugin-workflow.yaml @@ -54,3 +54,41 @@ jobs: run: yarn publish --non-interactive env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + publishGHCR: + name: publish to GitHub registry + runs-on: ubuntu-latest + timeout-minutes: 20 + + defaults: + run: + working-directory: backstage-plugin + steps: + - uses: actions/checkout@v4 + + - name: setup nodejs + uses: actions/setup-node@v3 + 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: publish + 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 }} \ No newline at end of file