Support inline expression with casting #2734
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' | |
secrets: | |
CLOUDFLARE_API_TOKEN: | |
required: false | |
CLOUDFLARE_ACCOUNT_ID: | |
required: false | |
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: choice | |
default: 'next' | |
options: | |
- next | |
- stable | |
description: The github deployment which is targeted, gets prefixed by 'docs-' | |
version: | |
required: false | |
type: string | |
default: '0.0.1-dev' | |
description: The version of Mapperly to be referenced from the documentation | |
pull_request: | |
branches: | |
- '**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "building ${{ inputs.version }} for ${{ inputs.environment }}" | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
- run: dotnet tool restore | |
- run: dotnet build | |
- uses: actions/setup-node@v4 | |
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@v4 | |
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@v4 | |
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 | |
# we never want to deploy with no version set | |
# stop the deployment here | |
- name: Version not set | |
if: ${{ inputs.version == '' || inputs.version == '0.0.1-dev' }} | |
run: exit 1 | |
- 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' |