From 1b1cde5accde610428056675fe9f992b6b4b5c09 Mon Sep 17 00:00:00 2001 From: Tudor Popa Date: Fri, 5 Aug 2022 13:52:06 +0200 Subject: [PATCH] feat(cicd): update docsite publish workflow to publish to github pages --- .github/workflows/docsite-publish-ghpages.yml | 73 +++++++++++++++++++ .github/workflows/docsite-publish.yml | 9 --- 2 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/docsite-publish-ghpages.yml diff --git a/.github/workflows/docsite-publish-ghpages.yml b/.github/workflows/docsite-publish-ghpages.yml new file mode 100644 index 0000000000000..953cff019a45c --- /dev/null +++ b/.github/workflows/docsite-publish-ghpages.yml @@ -0,0 +1,73 @@ +# Workflow name +name: 'Docsite publish' + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + if: ${{ contains(github.event.head_commit.message, 'applying package updates') || github.event_name == 'workflow_dispatch' }} + + outputs: + status: ${{ steps.verify-react-components-changed.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' }} + + steps: + - uses: actions/checkout@v3 + name: Checkout [master] + + - name: Verify react-compoenents has changed + uses: tj-actions/changed-files@v23.1 + id: verify-react-components-changed + with: + files: | + packages/react-components/react-components/package.json + build: + runs-on: ubuntu-latest + needs: check + if: needs.check.outputs.status == 'true' + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v3 + with: + node-version: 14.18.1 + cache: 'yarn' + + - name: Install packages + run: yarn install --frozen-lockfile + + - name: Build dependencies + run: yarn build --to @fluentui/public-docsite-v9 + + - name: Build storybook + run: yarn workspace @fluentui/public-docsite-v9 build-storybook + + - name: Upload Pages Artifact + uses: actions/upload-pages-artifact@v1 + with: + path: './apps/public-docsite-v9/dist/storybook/' + deploy: + runs-on: ubuntu-latest + needs: build + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.github/workflows/docsite-publish.yml b/.github/workflows/docsite-publish.yml index 65cf799be56e9..cef2a0ee4ddf3 100644 --- a/.github/workflows/docsite-publish.yml +++ b/.github/workflows/docsite-publish.yml @@ -6,15 +6,6 @@ on: branches: - master workflow_dispatch: - # both inputs are required by chromaui/action - # https://github.com/chromaui/action#triggering-from-workflow_dispatch - inputs: - sha: - description: The SHA-1 hash referring to the commit which will be used for publishing. - required: true - ref: - description: The head branch associated with the pull request. - required: true jobs: check: