[docathon] Clean up metadata docs (DOC-382) #146
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: Deploy Docs Revamp | |
on: | |
push: | |
branches: | |
- master | |
- docs-prod | |
paths: | |
- .github/workflows/build-docs-revamp.yml | |
- docs/docs-beta/** | |
- examples/docs_beta_snippets/** | |
pull_request: | |
paths: | |
- docs/docs-beta/** | |
- examples/docs_beta_snippets/** | |
- .github/workflows/build-docs-revamp.yml | |
concurrency: | |
group: ${{ github.workflow}}-${{github.ref}} | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
# Deploy to Vercel Previews on pull request, push to master branch | |
steps: | |
- name: Get branch preview subdomain | |
env: | |
HEAD_REF: ${{ github.head_ref }} | |
REF_NAME: ${{ github.ref_name }} | |
if: | | |
github.event_name == 'pull_request' || | |
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/heads/docs-prod'))) | |
run: | | |
BRANCH_PREVIEW_SUBDOMAIN=$(echo "${HEAD_REF:-$REF_NAME}" | sed -e 's/[^a-zA-Z0-9-]/-/g; s/^-*//; s/-*$//') | |
echo "$BRANCH_PREVIEW_SUBDOMAIN" | |
echo "BRANCH_PREVIEW_SUBDOMAIN=$BRANCH_PREVIEW_SUBDOMAIN" >> "${GITHUB_ENV}" | |
- name: Get fetch depth | |
run: | | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
echo "FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV | |
else | |
echo "FETCH_DEPTH=1" >> $GITHUB_ENV | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: ${{ env.FETCH_DEPTH }} | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Lint Docs | |
run: | | |
cd docs/docs-beta | |
yarn install | |
yarn run lint | |
- name: Get changed docs files for PR comment | |
if: ${{ github.event.pull_request }} | |
run: | | |
echo "Head ref is $GITHUB_HEAD_SHA" | |
git fetch origin $GITHUB_HEAD_SHA | |
# Compare the commit the branch is based on to its head to list changed files | |
CHANGED_MD_FILES=$(git diff --name-only HEAD~${{ github.event.pull_request.commits }} "$GITHUB_HEAD_SHA" -- '*.md') | |
CHANGES_ENTRY=$(echo "$CHANGED_MD_FILES" | sed 's/\.md$//' | sed 's/^docs-beta\/docs/- {{deploymentUrl}}/') | |
CHANGES_ENTRY=$(echo -e "Preview available at {{deploymentUrl}}\n\nDirect link to changed pages:\n$CHANGES_ENTRY") | |
echo "$CHANGES_ENTRY" | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "CHANGES_ENTRY<<$EOF" >> $GITHUB_ENV | |
echo "$CHANGES_ENTRY" >> $GITHUB_ENV | |
echo "$EOF" >> $GITHUB_ENV | |
env: | |
GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
- name: Publish Preview to Vercel | |
uses: amondnet/vercel-action@v25 | |
if: | | |
github.event_name == 'pull_request' || | |
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/heads/docs-prod'))) | |
with: | |
github-comment: true | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel-project-id: ${{ secrets.VERCEL_DOCS_NEXT_PROJECT_ID }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
scope: ${{ secrets.VERCEL_ORG_ID }} | |
alias-domains: ${{ env.BRANCH_PREVIEW_SUBDOMAIN }}.dagster.dagster-docs.io | |
- name: Publish to Vercel Production | |
uses: amondnet/vercel-action@v25 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel-project-id: ${{ secrets.VERCEL_DOCS_NEXT_PROJECT_ID }} | |
vercel-args: "--prod" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
scope: ${{ secrets.VERCEL_ORG_ID }} | |
alias-domains: dagster-docs-beta.dagster-docs.io |