refactor(core): cleanup and consistency with themeing #777
This file contains hidden or 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: Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-deploy | |
| cancel-in-progress: false | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| truncate-url-slug: | |
| name: Truncate URL | |
| runs-on: ubuntu-latest | |
| outputs: | |
| slug: ${{ steps.truncate-url.outputs.slug }} | |
| steps: | |
| - name: Display branch name | |
| run: echo ${GITHUB_HEAD_REF} | |
| - name: truncate Url | |
| id: truncate-url | |
| run: echo "slug=ks-$(echo ${GITHUB_HEAD_REF} | tr '[:upper:]' '[:lower:]' | tr -c '[:alnum:]' '-' | cut -c1-30 | sed 's/-*$//')" >> "$GITHUB_OUTPUT" | |
| deploy-workers: | |
| name: Publish to Cloudflare Workers | |
| runs-on: ubuntu-latest | |
| needs: truncate-url-slug | |
| env: | |
| CF_PAGES_BRANCH: ${{ github.ref_name }} | |
| CF_PAGES_COMMIT_SHA: ${{ github.sha }} | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| environment: | |
| name: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Preview' }} | |
| url: ${{ github.ref == 'refs/heads/main' && 'https://kestra.io' || format('https://{0}-docs.kestra-io.workers.dev', needs.truncate-url-slug.outputs.slug) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Node via nvm | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: ".nvmrc" | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Lint all files | |
| if: ${{ startsWith(github.repository, 'kestra-io/') && github.event_name == 'pull_request'}} | |
| run: npm run lint | |
| - name: Build | |
| run: npm run build | |
| env: | |
| NO_IMAGE_OPTIM: ${{ startsWith(github.repository, 'kestra-io/') && github.ref != 'refs/heads/main' && 'true' || 'false' }} | |
| PREVIEW: ${{ startsWith(github.repository, 'kestra-io/') && github.ref != 'refs/heads/main' && 'true' || 'false' }} | |
| - name: Deploy Worker | |
| id: prod-deploy | |
| if: ${{ startsWith(github.repository, 'kestra-io/') && github.ref == 'refs/heads/main' }} | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_ACCOUNT_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: deploy | |
| - name: Deploy Preview Worker | |
| id: preview-deploy | |
| if: ${{ startsWith(github.repository, 'kestra-io/') && github.ref != 'refs/heads/main' }} | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_ACCOUNT_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: versions upload --preview-alias="${{ needs.truncate-url-slug.outputs.slug }}" | |
| - name: Add comment to PR | |
| if: ${{ startsWith(github.repository, 'kestra-io/') && github.event_name == 'pull_request'}} | |
| uses: kestra-io/actions/actions/comment-update@main | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| title: "☁️ Cloudflare Worker Preview Deployed!" | |
| template: | | |
| 🔗 [${{ format('https://{0}-docs.kestra-io.workers.dev', needs.truncate-url-slug.outputs.slug) }}](${{ format('https://{0}-docs.kestra-io.workers.dev', needs.truncate-url-slug.outputs.slug) }}) | |
| 🔗 [${{ steps.preview-deploy.outputs.deployment-url }}](${{ steps.preview-deploy.outputs.deployment-url }}) |