ON_TRIGGER - Build #5
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: ON_TRIGGER - Build | |
env: | |
pages_domain: "docs.casper.network" | |
selected_node_version: 21.6 | |
working_directory: ./build | |
site_url: "http://docs.casper.network/" | |
base_url: "http://docs.casper.network/" | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Change to root directory | |
run: | | |
cd ./cspr-docs | |
- name: Use Node.js ${{ env.selected_node_version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.selected_node_version }} | |
cache: yarn | |
- name: Template credentials - staging | |
uses: cuchi/jinja2-action@1149b92d9ea6db61d7f71c22e3d5028d8065f140 | |
with: | |
template: ../.github/templates/.env.staging.j2 | |
output_file: .env.staging | |
env: | |
ALGOLIA_APP_ID: ${{ vars.ALGOLIA_APP_ID }} | |
ALGOLIA_INDEX_NAME: ${{ vars.ALGOLIA_INDEX_NAME }} | |
ALGOLIA_API_KEY: ${{ vars.ALGOLIA_API_KEY }} | |
CROWDIN_PERSONAL_ACCESS_TOKEN: "" | |
GOOGLE_TAG_ANONYMIZE_IP: ${{ vars.GOOGLE_TAG_ANONYMIZE_IP }} | |
GOOGLE_TAG_TRACKING_ID: ${{ vars.GOOGLE_TAG_TRACKING_ID }} | |
GOOGLE_TAG_MANAGER_ID: ${{ vars.GOOGLE_TAG_MANAGER_ID }} | |
SITE_URL: ${{ env.site_url }} | |
ALGOLIA_SITE_APP_ID: ${{ vars.ALGOLIA_SITE_APP_ID }} | |
ALGOLIA_SITE_API_KEY: ${{ vars.ALGOLIA_SITE_API_KEY }} | |
ALGOLIA_SITE_INDEX_NAME: ${{ vars.ALGOLIA_SITE_INDEX_NAME }} | |
BASE_URL: ${{ env.base_url }} | |
- name: Yarn install | |
run: | | |
yarn install | |
- name: Run code analysis | |
run: | | |
yarn format | |
- name: Clear Docusaurus cache | |
run: | | |
yarn clear | |
- name: Build app | |
run: | | |
yarn build --out-dir $working_directory | |
env: | |
NODE_ENV: staging | |
- name: Add CNAME file to the build output payload to keep the custom domain settings of GitHub Pages enabled | |
run: | | |
echo "$pages_domain" > $working_directory/CNAME | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: gh-pages-depl-payload | |
path: $working_directory |