Publish github pages #48
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 github pages | |
on: | |
#push: | |
# branches: [master] | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
name: Install deps, build and publish | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2-beta | |
with: | |
node-version: 12 | |
- name: Install root packages | |
run: npm install | |
- name: Generate library | |
run: | | |
pushd library | |
npm run build | |
popd | |
- name: Generate examples and copy to pages | |
run: | | |
pushd examples | |
npm run build | |
cp -r dist ../pages | |
mv ../pages/dist ../pages/examples | |
popd | |
- name: Generate explorer and copy to pages | |
run: | | |
pushd explorer | |
npm run build | |
cp -r dist ../pages | |
mv ../pages/dist ../pages/explorer | |
popd | |
- name: Generate browser and copy to pages | |
run: | | |
pushd browser | |
npm run build | |
cp -r dist ../pages | |
mv ../pages/dist ../pages/browser | |
popd | |
- name: Deploy to GitHub Pages | |
if: success() | |
uses: crazy-max/ghaction-github-pages@v2 | |
with: | |
target_branch: gh-pages | |
build_dir: pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: ReleaseName | |
id: ReleaseName | |
run: echo "::set-output name=release::$(git describe --abbrev=0)-$(echo ${GITHUB_SHA} | cut -c1-8)" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.ReleaseName.outputs.release }} | |
release_name: Release ${{ steps.ReleaseName.outputs.release }} | |
draft: false | |
prerelease: false | |
body: This is an automated release from master. Builds are in the build-artifacts.zip | |
- name: Compress build artifacts | |
run: | | |
zip build-artifacts.zip library/build/* | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./build-artifacts.zip | |
asset_name: build-artifacts.zip | |
asset_content_type: application/zip |