Skip to content

Add support for From and To method conversions (#1117) #3070

Add support for From and To method conversions (#1117)

Add support for From and To method conversions (#1117) #3070

Workflow file for this run

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'