Pin semantic release version & specify node version for release github action #127
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 build docs and deploy it to https://rangle.github.io/radius-tracker/ | |
# For more information see: https://github.com/marketplace/actions/deploy-to-github-pages | |
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
env: | |
PR_NUM: ${{ github.event.pull_request.number }} | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v2 | |
- name: Install Yarn π§ | |
if: ${{ env.ACT }} | |
run: npm install -g yarn | |
- name: Install Rsync π | |
if: ${{ env.ACT }} | |
run: apt-get update && apt-get install -y rsync | |
- name: Comment on PR π¬ | |
if: github.ref != 'refs/heads/main' | |
uses: hasura/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.number }} | |
id: deploy-preview | |
message: "Initializing deploy of documentation site preview... β³" | |
- name: Set BASE_URL for Preview Build π¨ | |
if: github.ref != 'refs/heads/main' | |
run: echo BASE_URL="https://rangle.github.io/radius-tracker/pull/${{ env.PR_NUM }}" >> $GITHUB_ENV | |
- name: Cache build artifacts πΎ | |
if: github.ref == 'refs/heads/main' | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
key: ${{ runner.os }}-${{ hashFiles('src/docs/pages', 'src/docs/next.config.js', 'src/docs/theme.config.jsx') }} | |
path: src/docs/out | |
- name: Build Docs Site π | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn docs-build | |
- name: Deploy (main branch) π | |
if: github.ref == 'refs/heads/main' | |
uses: JamesIves/[email protected] | |
with: | |
clean-exclude: pull | |
branch: gh-pages | |
folder: src/docs/out | |
token: ${{secrets.GITHUB_TOKEN}} | |
- name: Deploy (PR Preview) π | |
if: github.ref != 'refs/heads/main' | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: src/docs/out | |
target-folder: pull/${{ env.PR_NUM }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
clean: false | |
- name: Update PR comment π¬ | |
if: github.ref != 'refs/heads/main' | |
uses: hasura/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.number }} | |
id: deploy-preview | |
message: "π Deploy of docs site preview has been started. It will take a minute or two for changes to appear on the site. See changes here: ${{ env.BASE_URL }}" |