diff --git a/.github/workflows/pr-website.yaml b/.github/workflows/pr-website.yaml deleted file mode 100644 index 5dc4e332f8..0000000000 --- a/.github/workflows/pr-website.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: Pull request website - -# Do not abstract the build step into a separate workflow file, as it will run into pathname issues - -on: - pull_request: - paths: - - '**/README.md' - -jobs: - build-website: - name: Build website - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - repository: janus-idp/janus-idp.github.io - persist-credentials: false - fetch-depth: 0 - - - uses: pnpm/action-setup@v3 - name: Install pnpm - id: pnpm-install - - - name: Setup Node.js - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: | - pnpm install - if [[ $(git diff --name-only . || true) ]]; then - echo "After 'pnpm install', workspace is dirty! The following files have changed:" - echo - git diff --name-only . || true - exit 42 - fi - - - name: Run Build - run: pnpm run build --filter=website diff --git a/.github/workflows/publish-backend-plugin-manager.yaml b/.github/workflows/publish-backend-plugin-manager.yaml deleted file mode 100644 index 420cb7962b..0000000000 --- a/.github/workflows/publish-backend-plugin-manager.yaml +++ /dev/null @@ -1,213 +0,0 @@ -# Copyright 2023 The Janus IDP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Publish Backend Plugin Manager - -on: - # schedule: - # - cron: '20 * * * *' # every hour at 20 minutes - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - inputs: - git_ref: - description: Git reference for the upstream repository checkout - type: string - default: 'master' - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true - -env: - SCOPE: '@janus-idp' - -jobs: - build: - # build the backend plugin manager in the backstage/backstage GitHub repository - # and publish it to the NPMJS repository @janus-idp organization, - # with changed scope and version - name: Publish Backend Plugin Manager - runs-on: ubuntu-latest - - steps: - - name: Set GitHub Ref to checkout - id: get_checkout_ref - run: | - if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then - GIT_REF=${{ inputs.git_ref }} - else - GIT_REF=master - fi - echo "GIT_REF=$GIT_REF" >> $GITHUB_OUTPUT - - - name: Checkout from master - if: steps.get_checkout_ref.outputs.GIT_REF == 'master' - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - repository: backstage/backstage - ref: master - # fetch all history, but only for the current ref - fetch-depth: 2147483647 - fetch-tags: false - - - name: Checkout from a git ref - if: steps.get_checkout_ref.outputs.GIT_REF != 'master' - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - repository: backstage/backstage - ref: '${{ steps.get_checkout_ref.outputs.GIT_REF }}' - - - name: Get sha of the latest backend-plugin-manager commit - id: get_commit_sha - run: | - if [[ ${{ steps.get_checkout_ref.outputs.GIT_REF }} == "master" ]]; then - echo "COMMIT_ID=$(git rev-list --max-count=1 HEAD -- packages/backend-plugin-manager)" >> "$GITHUB_OUTPUT" - else - echo "COMMIT_ID=$(git rev-list --max-count=1 HEAD)" >> "$GITHUB_OUTPUT" - fi - echo "GH Output: " && cat $GITHUB_OUTPUT - - - name: Test if commit is already published - id: test_commit_already_published - env: - COMMIT_ID: ${{ steps.get_commit_sha.outputs.COMMIT_ID }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | - echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc - if [ "_$(npm dist-tag ls $SCOPE/backend-plugin-manager | grep -e ^$COMMIT_ID || echo '')" != "_" ]; then ALREADY_PUSHED="true"; else ALREADY_PUSHED="false"; fi - echo "ALREADY_PUSHED=$ALREADY_PUSHED" >> "$GITHUB_OUTPUT" - echo "GH Output: " && cat $GITHUB_OUTPUT - - - name: Setup Node.js - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 - if: steps.test_commit_already_published.outputs.ALREADY_PUSHED == 'false' - env: - FORCE_COLOR: 0 - with: - node-version: 18 - cache: 'yarn' - - - name: Get the version of the backend-plugin-manager package - id: get_package_version - run: | - echo "PACKAGE_VERSION=$(node -p "require('./packages/backend-plugin-manager/package.json').version")" >> "$GITHUB_OUTPUT" - echo "GH Output: " && cat $GITHUB_OUTPUT - - - name: Get the last version of the backend-plugin-manager package pushed to the NPMJS repository - id: get_last_pushed_version - if: steps.test_commit_already_published.outputs.ALREADY_PUSHED == 'false' - env: - COMMIT_VERSION: ${{ steps.get_package_version.outputs.PACKAGE_VERSION }} - run: | - echo "LAST_PUSHED_VERSION=$(npm view $SCOPE/backend-plugin-manager@^${COMMIT_VERSION}-janus version | sed -e "s/^.*'\(.*\)'/\1/" | sort | tail -1)" >> "$GITHUB_OUTPUT" - echo "GH Output: " && cat $GITHUB_OUTPUT - - - name: Get new version to push - id: get_new_version_to_push - if: steps.test_commit_already_published.outputs.ALREADY_PUSHED == 'false' - env: - COMMIT_VERSION: ${{ steps.get_package_version.outputs.PACKAGE_VERSION }} - LAST_PUSHED_VERSION: ${{ steps.get_last_pushed_version.outputs.LAST_PUSHED_VERSION }} - GIT_REF: ${{ steps.get_checkout_ref.outputs.GIT_REF }} - run: | - # - # The new version to push to NPMS is calculated as follows: - # - # upstream version: 0.0.1-next.0, no pushed version => new version: 0.0.1-janus.0 - # upstream version: 0.0.1-next.0, already pushed version: 0.0.1-janus.0 => new version: 0.0.1-janus.1 - # upstream version: 0.0.1-next.0, already pushed version: 0.0.1-janus.1 => new version: 0.0.1-janus.2 - # upstream version: 0.0.1-next.1, already pushed version: 0.0.1-janus.2 => new version: 0.0.1-janus.3 - # upstream version: 0.0.1, already pushed version: 0.0.1-janus.3 => new version: 0.0.1-janus.4 - # upstream version: 0.0.2-next.0, already pushed version: 0.0.1-janus.4 => new version: 0.0.2-janus.0 - # etc ... - # - - # Parse the semantic version of the upstream `backend-plugin-manager` - - COMMIT_MAJOR=$(echo $COMMIT_VERSION | cut -d. -f1) - COMMIT_MINOR=$(echo $COMMIT_VERSION | cut -d. -f2) - COMMIT_PATCH=$(echo $COMMIT_VERSION | cut -d. -f3 | cut -d- -f1) - - # If the last pushed version is empty, set it to a default value, and then parse it - - if [ -z "$LAST_PUSHED_VERSION" ]; then - LAST_PUSHED_VERSION=$COMMIT_MAJOR.$COMMIT_MINOR.$COMMIT_PATCH-janus.0 - fi - - LAST_PUSHED_MAJOR=$(echo $LAST_PUSHED_VERSION | cut -d. -f1) - LAST_PUSHED_MINOR=$(echo $LAST_PUSHED_VERSION | cut -d. -f2) - LAST_PUSHED_PATCH=$(echo $LAST_PUSHED_VERSION | cut -d. -f3 | cut -d- -f1) - LAST_PUSHED_PRERELEASE_WITHOUT_NUMBER=$(echo $LAST_PUSHED_VERSION | cut -d- -f2 | cut -d. -f1) - LAST_PUSHED_PRERELEASE_NUMBER=$(echo $LAST_PUSHED_VERSION | cut -d- -f2 | cut -d. -f2) - - # if base version (without pre-release part) is the same for upstream package and pushed NPM package, - # then just increment the pre-release number, - # otherwise, use the base version of the upstream package, and reset the `.janus.` pre-release number to 0. - - if [ "$COMMIT_MAJOR.$COMMIT_MINOR.$COMMIT_PATCH" == "$LAST_PUSHED_MAJOR.$LAST_PUSHED_MINOR.$LAST_PUSHED_PATCH" ]; then - PRERELEASE="janus.$((LAST_PUSHED_PRERELEASE_NUMBER+1))" - else - PRERELEASE="janus.0" - fi - - echo "VERSION=$COMMIT_MAJOR.$COMMIT_MINOR.$COMMIT_PATCH-$PRERELEASE" >> "$GITHUB_OUTPUT" - echo "GH Output: " && cat $GITHUB_OUTPUT - - - name: Update BackendPluginManager package.json with changed scope and version, and make it public - if: steps.test_commit_already_published.outputs.ALREADY_PUSHED == 'false' - env: - VERSION: ${{ steps.get_new_version_to_push.outputs.VERSION }} - run: | - sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" packages/backend-plugin-manager/package.json - sed -i "s/\"name\": \"@backstage\/backend-plugin-manager\"/\"name\": \"$SCOPE\/backend-plugin-manager\"/" packages/backend-plugin-manager/package.json - sed -i "s/\"private\": true/\"private\": false/" packages/backend-plugin-manager/package.json - echo "Package.JSON:" && cat packages/backend-plugin-manager/package.json - - - name: Install Dependencies - env: - YARN_ENABLE_IMMUTABLE_INSTALLS: 'false' - if: steps.test_commit_already_published.outputs.ALREADY_PUSHED == 'false' - run: yarn install - - - name: Build the backend-plugin-manager package - if: steps.test_commit_already_published.outputs.ALREADY_PUSHED == 'false' - env: - NODE_OPTIONS: '--max-old-space-size=4096' - run: | - yarn tsc - yarn workspace $SCOPE/backend-plugin-manager build - - - name: Publish to NPM with the tag as the commit sha - if: steps.test_commit_already_published.outputs.ALREADY_PUSHED == 'false' - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - COMMIT_ID: ${{ steps.get_commit_sha.outputs.COMMIT_ID }} - VERSION: ${{ steps.get_new_version_to_push.outputs.VERSION }} - run: | - yarn config set 'npmAuthToken' "$NPM_TOKEN" - yarn workspace $SCOPE/backend-plugin-manager npm publish --access public --tag latest - yarn npm tag add $SCOPE/backend-plugin-manager@$VERSION $COMMIT_ID - - - name: Tag the package with backstage release tag if is a release commit - if: - steps.test_commit_already_published.outputs.ALREADY_PUSHED == 'false' && - startsWith(steps.get_checkout_ref.outputs.GIT_REF, 'v') - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - GIT_REF: ${{ steps.get_checkout_ref.outputs.GIT_REF }} - VERSION: ${{ steps.get_new_version_to_push.outputs.VERSION }} - run: | - yarn config set 'npmAuthToken' "$NPM_TOKEN" - yarn npm tag add $SCOPE/backend-plugin-manager@$VERSION $GIT_REF diff --git a/.github/workflows/push-website.yaml b/.github/workflows/push-website.yaml deleted file mode 100644 index bd55712818..0000000000 --- a/.github/workflows/push-website.yaml +++ /dev/null @@ -1,56 +0,0 @@ -name: Push website - -# Do not abstract the build step into a separate workflow file, as it will run into pathname issues - -on: - push: - branches: - - main - paths: - - '**/README.md' - -concurrency: - group: push-website - cancel-in-progress: true - -jobs: - build-website: - name: Build website - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - repository: janus-idp/janus-idp.github.io - persist-credentials: false - fetch-depth: 0 - - - uses: pnpm/action-setup@v3 - name: Install pnpm - id: pnpm-install - - - name: Setup Node.js - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 - with: - node-version-file: '.nvmrc' - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install --prefer-offline --frozen-lockfile - - - name: Run Build - run: pnpm run build --filter=website - - dispatch-website: - name: Dispatch website - needs: - - build-website - runs-on: ubuntu-latest - steps: - - name: Repository Dispatch - uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2 - with: - token: ${{ secrets.PAT }} - repository: janus-idp/janus-idp.github.io - event-type: deploy-website - client-payload: '{"github": ${{ toJson(github) }}}' diff --git a/.github/workflows/update-changeset-prs.yaml b/.github/workflows/update-changeset-prs.yaml index 9296f14a39..b5477273ee 100644 --- a/.github/workflows/update-changeset-prs.yaml +++ b/.github/workflows/update-changeset-prs.yaml @@ -5,10 +5,6 @@ on: branches: - 'changeset-release/**' -env: - TURBO_SCM_BASE: ${{ github.event.before }} - TURBO_SCM_HEAD: ${{ github.sha }} - # enforce only one release action per release branch at a time concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -61,7 +57,23 @@ jobs: # We want to commit the yarn.lock changes run: yarn install + - name: Get latest commit on release branch + id: get-latest-commit + uses: actions/github-script@v6 + with: + script: | + const { data } = await github.rest.repos.getBranch({ + owner: context.repo.owner, + repo: context.repo.repo, + branch: 'release-1.3' + }); + console.log('Latest commit SHA:', data.commit.sha); + core.setOutput('main_sha', data.commit.sha); + - name: Clean export dynamic + env: + TURBO_SCM_BASE: ${{ steps.get-latest-commit.outputs.main_sha }} + TURBO_SCM_HEAD: ${{ github.sha }} # We want a clean dynamic folder run: yarn run export-dynamic:clean --concurrency=75% --affected