diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 68f63720..f3879c42 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -31,30 +31,6 @@ jobs: run: sbt -J-XX:+UseG1GC -J-Xmx6g -J-Xms6g -J-Xss16m +publishLocal - name: Check website build process run: sbt docs/clean; sbt docs/buildWebsite - publish-docs: - name: Publish Docs - runs-on: ubuntu-latest - if: ${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }} - steps: - - name: Git Checkout - uses: actions/checkout@v3.3.0 - with: - fetch-depth: '0' - - name: Setup Scala - uses: actions/setup-java@v3.9.0 - with: - distribution: temurin - java-version: 17 - check-latest: true - - name: Setup NodeJs - uses: actions/setup-node@v3 - with: - node-version: 16.x - registry-url: https://registry.npmjs.org - - name: Publish Docs to NPM Registry - run: sbt docs/publishToNpm - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} generate-readme: name: Generate README runs-on: ubuntu-latest @@ -92,3 +68,67 @@ jobs: commit-message: Update README.md delete-branch: true title: Update README.md + - name: Approve PR + if: ${{ steps.cpr.outputs.pull-request-number }} + run: gh pr review "$PR_URL" --approve + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ steps.cpr.outputs.pull-request-url }} + - name: Enable Auto-Merge + if: ${{ steps.cpr.outputs.pull-request-number }} + run: gh pr merge --auto --squash "$PR_URL" || gh pr merge --squash "$PR_URL" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ steps.cpr.outputs.pull-request-url }} + publish-docs: + name: Publish Docs + runs-on: ubuntu-latest + if: ${{ ((github.event_name == 'release') && (github.event.action == 'published')) || (github.event_name == 'workflow_dispatch') }} + steps: + - name: Git Checkout + uses: actions/checkout@v3.3.0 + with: + fetch-depth: '0' + - name: Setup Scala + uses: actions/setup-java@v3.9.0 + with: + distribution: temurin + java-version: 17 + check-latest: true + - name: Setup NodeJs + uses: actions/setup-node@v3 + with: + node-version: 16.x + registry-url: https://registry.npmjs.org + - name: Publish Docs to NPM Registry + run: sbt docs/publishToNpm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + notify-docs-release: + name: Notify Docs Release + runs-on: ubuntu-latest + continue-on-error: false + needs: + - release-docs + if: ${{ (github.event_name == 'release') && (github.event.action == 'published') }} + steps: + - name: Git Checkout + uses: actions/checkout@v4 + with: + fetch-depth: '0' + - name: notify the main repo about the new release of docs package + run: | + PACKAGE_NAME=$(cat docs/package.json | grep '"name"' | awk -F'"' '{print $4}') + PACKAGE_VERSION=$(npm view $PACKAGE_NAME version) + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${{ secrets.PAT_TOKEN }}"\ + https://api.github.com/repos/zio/zio/dispatches \ + -d '{ + "event_type":"update-docs", + "client_payload":{ + "package_name":"'"${PACKAGE_NAME}"'", + "package_version": "'"${PACKAGE_VERSION}"'" + } + }' \ No newline at end of file