Dynamically generate PCT Report (#820) #110
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Website | |
on: | |
push: | |
branches: | |
- master | |
env: | |
# Used by docusaurus `publish-site` step | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPO_NAME: ${{ github.event.repository.name }} | |
jobs: | |
publish-website: | |
name: Publish Website | |
# There is currently no way to limit workflow dispatch to only allow default branch | |
# so we need to restrict it here | |
# See https://github.community/t/limit-branch-for-workflow-dispatch/122099 | |
if: github.ref == 'refs/heads/master' && github.repository == 'finos/legend' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3.5.2 | |
- name: Setup Node | |
uses: actions/setup-node@v3.6.0 | |
with: | |
node-version: 16 | |
- name: Prepare static artifacts | |
run: | | |
cp -r installers/omnibus/scripts/* website/static/omnibus | |
- name: Build Website | |
working-directory: ./website | |
run: | | |
npm install | |
npm run build | |
- name: Search for Broken Links | |
run: | | |
node ./scripts/check-legend-application-documentation-broken-links.js | |
- name: Publish Website | |
if: github.repository == 'finos/legend' # skip running action in forks | |
run: | | |
# Extract GitHub org/user | |
REPO="${{ github.repository }}" | |
GIT_USERNAME=${REPO%/*} | |
# Set git user to finos, if it's a push to a finos repo | |
if [ "$GIT_USERNAME" == "finos" ] && [ "${{github.event_name }}" == "push" ] | |
then GIT_USERNAME="finos" | |
elif [ "$GIT_USERNAME" == "finos" ] && [ "${{github.event_name }}" == "pull_request" ] | |
then echo "Skipping publishing, as it's coming from a PR"; exit 0 | |
fi | |
# Configure git client | |
echo "Git repo - $REPO" | |
echo "Git user - $GIT_USERNAME" | |
git config --global user.email "$GIT_USERNAME@users.noreply.github.com" | |
git config --global user.name "$GIT_USERNAME" | |
echo "machine github.com login $GIT_USERNAME password $GITHUB_TOKEN" > ~/.netrc | |
GIT_USER=$GIT_USERNAME npm run deploy --prefix website |