v2.0.13 #28
Workflow file for this run
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and site, and run the deploy script. | |
# The deploy script will publish the build to gh-pages. | |
# This workflow will be run whenever a new release is published. | |
# NOTE (pradeep): I'm having this workflow bail out if the release doesn't target v2.0.x | |
# This is because we don't have a way (yet) to support multiple FDT versions/docs be deployed at the same time, | |
# and hence we choose to deploy only the most stable release. | |
# Guide: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Deploy to gh-pages | |
on: | |
release: | |
types: [published] | |
# Allow only one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
check-release: | |
name: Check release version | |
runs-on: ubuntu-latest | |
# map step output to job output | |
outputs: | |
is_stable: ${{ steps.check-release-stable.outputs.is_stable }} | |
steps: | |
- name: Check if release is stable | |
id: check-release-stable | |
env: | |
# Store the tag name of the release in `RELEASE_TAG` (eg: v1.0.10) | |
RELEASE_TAG: ${{ github.event.release.tag_name }} | |
# Check if the release tag name is a stable candidate for deployment | |
# NOTE (pradeep): Only allow 2.0.x versions to be deployed right now | |
run: | | |
echo "RELEASE_TAG is: " $RELEASE_TAG | |
if [[ $RELEASE_TAG =~ ^v2\.0\.[0-9]+$ ]]; | |
then | |
echo "This is a stable release!" | |
echo "::set-output name=is_stable::true" | |
else | |
echo "This is not a stable release!" | |
echo "::set-output name=is_stable::false" | |
fi | |
build: | |
name: Build and upload artifacts | |
needs: check-release | |
runs-on: ubuntu-latest | |
# skip deploying to gh-pages if release is not "stable" | |
if: ${{ needs.check-release.outputs.is_stable == 'true' }} | |
steps: | |
# checkout our repo for the current commit | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
# setup node version 16 which is not old but still stable | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile # do a clean install of all of our dependencies | |
# build our static site contents | |
- name: Build static site! | |
run: yarn run site-build | |
# upload the static site contents as an artifact. | |
# the artifact is non-optional, and is consumed in the next job. | |
- name: Upload static site artifacts | |
uses: actions/[email protected] | |
with: | |
path: "__site__/" | |
deploy: | |
name: Deploy site | |
needs: build | |
runs-on: ubuntu-latest | |
# 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 soure | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
# publish our site to gh-pages | |
- name: Deploy GitHub Pages | |
id: deployment | |
uses: actions/[email protected] |