|
| 1 | +name: Docs and Site |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - "docs/**" |
| 7 | + branches: |
| 8 | + - master |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + node-version: [12.x] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Grab the Master Branch |
| 20 | + uses: actions/checkout@v1 |
| 21 | + with: |
| 22 | + working-directory: fhir |
| 23 | + ref: refs/heads/master |
| 24 | + fetch-depth: 1 |
| 25 | + path: fhir |
| 26 | + - name: Use Node.js ${{ matrix.node-version }} |
| 27 | + uses: actions/setup-node@v1 |
| 28 | + with: |
| 29 | + node-version: ${{ matrix.node-version }} |
| 30 | + - name: Build Site |
| 31 | + run: | |
| 32 | + echo "Check on Path" |
| 33 | + pwd |
| 34 | + cd docs/ |
| 35 | + npm install -g gatsby-cli |
| 36 | + gatsby telemetry --disable |
| 37 | + |
| 38 | + # Install the packages |
| 39 | + # fsevents is not used on linux images, so use --no-optional (these plugins are suspect) |
| 40 | + npm install --no-optional --save react react-copy-to-clipboard react-dom react-ga classnames carbon @carbon/addons-website carbon-components carbon-components-react carbon-addons-cloud carbon-icons gatsby gatsby-theme-carbon-starter markdown-it gatsby-plugin-manifest gatsby-plugin-slug gatsby-plugin-sitemap gatsby-plugin-sharp |
| 41 | +
|
| 42 | + # make sure yarn is run to avoid this issue with #98123 WEBPACK |
| 43 | + # add yarn --verbose to trace issues with yarn |
| 44 | + |
| 45 | + # don't use gatsby build directly per https://github.com/gatsbyjs/gatsby/issues/17557 |
| 46 | + # use the suggestion as a workaround due to path/issues in the gatsby component dependency of fsevents |
| 47 | + npm --prefix-paths run build |
| 48 | + cp -R public/ ../../public/ |
| 49 | + - name: Grab the GH Pages Branch |
| 50 | + uses: actions/checkout@v1 |
| 51 | + with: |
| 52 | + working-directory: gh-pages |
| 53 | + ref: refs/heads/gh-pages |
| 54 | + fetch-depth: 1 |
| 55 | + path: docs |
| 56 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + - name: Commit and Add GH Pages |
| 58 | + run: | |
| 59 | + echo "cleaning up the prior files on the branch" |
| 60 | + if [ ! -f .nojekyll ] |
| 61 | + then |
| 62 | + touch .nojekyll |
| 63 | + rm -f _config.yml |
| 64 | + fi |
| 65 | +
|
| 66 | + rm -f *.js webpack.stats.json styles-*.js styles-*.js.map webpack-runtime-*.js.map webpack-runtime-*.js manifest.webmanifest component---*.js* app-*.js* |
| 67 | + rm -rf docs/node_modules docs/public docs/.cache |
| 68 | + |
| 69 | + echo "Moving the files around for gh-pages" |
| 70 | + cp -Rf ../public/* ./ |
| 71 | + find . |
| 72 | + date > build.txt |
| 73 | + git config --global user.email "${{ secrets.GITHUB_ACTOR }}@users.noreply.github.com" |
| 74 | + git config --global user.name "Git Hub Site Automation" |
| 75 | + git add . |
| 76 | + git commit -m "Update to GH-Pages" |
| 77 | + - name: Push changes to GH Pages |
| 78 | + run: | |
| 79 | + echo "Push Changes" |
| 80 | + git branch |
| 81 | + remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" |
| 82 | + git push "${remote_repo}" HEAD:gh-pages |
| 83 | + env: |
| 84 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }} |
| 86 | + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} |
| 87 | + CI: true |
0 commit comments