From f9e4e22e5f80dbaadca4cc9ab65e334bd9df836c Mon Sep 17 00:00:00 2001 From: MT Lewis Date: Sun, 14 Apr 2024 21:08:08 +0100 Subject: [PATCH 1/3] sync_release-manifest: full yarn install Since we now need to build the yarn-plugin before pushing it to the versions repo for each release, we need a full yarn install in this repo. Signed-off-by: MT Lewis --- .github/workflows/sync_release-manifest.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sync_release-manifest.yml b/.github/workflows/sync_release-manifest.yml index db35945550..34bbabcd0b 100644 --- a/.github/workflows/sync_release-manifest.yml +++ b/.github/workflows/sync_release-manifest.yml @@ -12,14 +12,6 @@ jobs: with: egress-policy: audit - # Setup node & install deps before checkout, keeping install quick - - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 - with: - node-version: 18.x - - name: Install dependencies - # Just the deps for the assemble manifest script - run: npm install semver@7.3.5 fs-extra@10.0.0 @manypkg/get-packages@1.1.1 - - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: @@ -27,6 +19,18 @@ jobs: # 'v' prefix is added here for the tag, we keep it out of the manifest logic ref: v${{ github.event.client_payload.version }} + - name: use node.js 18.x + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: 18.x + registry-url: https://registry.npmjs.org/ # Needed for auth + + - name: yarn install + uses: backstage/actions/yarn-install@a674369920067381b450d398b27df7039b7ef635 # v0.6.5 + with: + path: backstage + cache-prefix: ${{ runner.os }}-v18.x + # Checkout backstage/versions into /backstage/versions, which is where store the output - name: Checkout versions uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 From 0bdf7ab1ebfdc211a72a394788cfc892a8eb3388 Mon Sep 17 00:00:00 2001 From: MT Lewis Date: Sun, 14 Apr 2024 21:16:04 +0100 Subject: [PATCH 2/3] sync_release-manifest: add yarn-plugin to release directory Since yarn plugins aren't installable via npm, we need a place to make the version available for each release. Since versions.backstage.io already provides an API backed by a git repo organized by release (and even includes release line links), it seems like the perfect spot. This commit adds the yarn plugin to the appropriate directory when the sync_release-management workflow runs, reorganizing the existing functionality for pushing the changes to the versions repo with a little bit of refactoring. Signed-off-by: MT Lewis --- .github/workflows/sync_release-manifest.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/sync_release-manifest.yml b/.github/workflows/sync_release-manifest.yml index 34bbabcd0b..e7c06747f7 100644 --- a/.github/workflows/sync_release-manifest.yml +++ b/.github/workflows/sync_release-manifest.yml @@ -31,6 +31,10 @@ jobs: path: backstage cache-prefix: ${{ runner.os }}-v18.x + - name: Build yarn plugin + working-directory: backstage/packages/yarn-plugin + run: yarn build + # Checkout backstage/versions into /backstage/versions, which is where store the output - name: Checkout versions uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -51,6 +55,20 @@ jobs: mkdir -p scripts wget -O scripts/assemble-manifest.js https://raw.githubusercontent.com/backstage/backstage/master/scripts/assemble-manifest.js node scripts/assemble-manifest.js ${{ github.event.client_payload.version }} + + # Copies the build output of the yarn-plugin package to the appropriate + # directory, allowing the plugin to be installed with a command like + # `yarn plugin import https://versions.backstage.io/v1/tags/main/yarn-plugin` + - name: Add yarn plugin to release + working-directory: backstage/packages/yarn-plugin + run: >- + cp + bundles/@yarnpkg/plugin-backstage.js + ../../versions/v1/releases/${{ github.event.client_payload.version }}/yarn-plugin + + - name: Commit to versions repo + working-directory: backstage/versions + run: | cd versions git add . git commit -am "${{ github.event.client_payload.version }}" From 513175ae970a34a29b900d4660a2ff45ebc9bedb Mon Sep 17 00:00:00 2001 From: MT Lewis Date: Sun, 14 Apr 2024 21:31:38 +0100 Subject: [PATCH 3/3] sync_release-manifest: remove top-level backstage directory The top-level backstage/ directory included in this repo means we can't use the yarn-install backstage action (or we'd have to add a `path` input option to it). Looking at this workflow, I can't actually spot why the top-level `backstage` dir is needed - nothing is ever written outside it as far as I can spot. With that in mind, proposing we remove it to simplify the workflow and enable the use of the `yarn-install` action without needing to extend it. Signed-off-by: MT Lewis --- .github/workflows/sync_release-manifest.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sync_release-manifest.yml b/.github/workflows/sync_release-manifest.yml index e7c06747f7..6d02309f8a 100644 --- a/.github/workflows/sync_release-manifest.yml +++ b/.github/workflows/sync_release-manifest.yml @@ -15,7 +15,6 @@ jobs: - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: - path: backstage # 'v' prefix is added here for the tag, we keep it out of the manifest logic ref: v${{ github.event.client_payload.version }} @@ -28,11 +27,10 @@ jobs: - name: yarn install uses: backstage/actions/yarn-install@a674369920067381b450d398b27df7039b7ef635 # v0.6.5 with: - path: backstage cache-prefix: ${{ runner.os }}-v18.x - name: Build yarn plugin - working-directory: backstage/packages/yarn-plugin + working-directory: packages/yarn-plugin run: yarn build # Checkout backstage/versions into /backstage/versions, which is where store the output @@ -40,7 +38,7 @@ jobs: uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: repository: backstage/versions - path: backstage/versions + path: versions token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }} - name: Configure Git @@ -51,7 +49,6 @@ jobs: - name: Create release # This grabs the scripts from master in order to support backfills run: | - cd backstage mkdir -p scripts wget -O scripts/assemble-manifest.js https://raw.githubusercontent.com/backstage/backstage/master/scripts/assemble-manifest.js node scripts/assemble-manifest.js ${{ github.event.client_payload.version }} @@ -60,16 +57,15 @@ jobs: # directory, allowing the plugin to be installed with a command like # `yarn plugin import https://versions.backstage.io/v1/tags/main/yarn-plugin` - name: Add yarn plugin to release - working-directory: backstage/packages/yarn-plugin + working-directory: packages/yarn-plugin run: >- cp bundles/@yarnpkg/plugin-backstage.js ../../versions/v1/releases/${{ github.event.client_payload.version }}/yarn-plugin - name: Commit to versions repo - working-directory: backstage/versions + working-directory: versions run: | - cd versions git add . git commit -am "${{ github.event.client_payload.version }}" git push @@ -87,7 +83,7 @@ jobs: workflow_id: 'release.yml', ref: 'master', inputs: { - version: require('./backstage/packages/create-app/package.json').version, - releaseVersion: require('./backstage/package.json').version + version: require('./packages/create-app/package.json').version, + releaseVersion: require('./package.json').version }, });