chore: add benchmark action #1204
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
name: docs | |
on: | |
workflow_call: | |
inputs: | |
deploy: | |
required: false | |
type: boolean | |
default: false | |
environment: | |
required: false | |
type: string | |
default: 'next' | |
version: | |
required: false | |
type: string | |
default: '0.0.1-dev' | |
workflow_dispatch: | |
inputs: | |
deploy: | |
required: false | |
type: boolean | |
default: true | |
description: A boolean indicating whether the built pages should be deployed | |
environment: | |
required: false | |
type: string | |
default: 'next' | |
description: The github deployment which is targeted, gets prefixed by 'docs-', should be 'next' or 'stable' | |
version: | |
required: false | |
type: string | |
default: '0.0.1-dev' | |
description: The version of Mapperly to be referenced from the documentation | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/configure-pages@v3 | |
- uses: actions/setup-dotnet@v3.2.0 | |
- run: dotnet tool restore | |
- run: dotnet build | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: './docs/.node-version' | |
- run: npm ci | |
working-directory: ./docs | |
- run: npm run lint | |
working-directory: ./docs | |
- run: npm run build | |
working-directory: ./docs | |
env: | |
MAPPERLY_VERSION: ${{ inputs.version }} | |
ENVIRONMENT: ${{ inputs.environment }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mapperly-docs | |
path: 'docs/build' | |
deploy: | |
if: ${{ inputs.deploy }} | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: docs-${{ inputs.environment }} | |
url: ${{ steps.deployment.outputs.page_url }} | |
concurrency: | |
group: pages | |
cancel-in-progress: true | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: mapperly-docs | |
path: 'docs/build' | |
# replace stable environment name with main | |
# cf pages only recognizes main as production branch | |
- uses: bluwy/substitute-string-action@v2 | |
id: cf-pages-branch-name | |
with: | |
_input-text: ${{ inputs.environment }} | |
stable: main | |
- uses: cloudflare/pages-action@v1 | |
id: deployment | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: mapperly | |
branch: ${{ steps.cf-pages-branch-name.outputs.result }} | |
directory: 'docs/build' |