gitbutler/.github/workflows/release-docs.yml
2024-07-17 09:35:37 +00:00

45 lines
1.4 KiB
YAML

name: Trigger Docs Build
on:
release:
types: [published]
jobs:
vercel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: gitbutlerapp/gitbutler-docs
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: "pnpm"
cache-dependency-path: |
pnpm-lock.yaml
- name: Install dependencies
run: pnpm install
- name: Add content
run: |
VERSION=$(echo ${{ github.event.release.tag_name }} | sed "s|^.*/||" )
NEW_RELEASE_BODY=$(cat <<- END
{/* NEW_RELEASE */}
${{ github.event.release.body }}
END
)
ESCAPED_DATA="$(echo "${NEW_RELEASE_BODY}" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/\$/\\$/g' | sed 's|<|\\\\<|g')"
NEW_CONTENT="$(echo "${ESCAPED_DATA}" | sed "s|## What's Changed|## ${VERSION}|")"
sed -i "s|{/\* NEW_RELEASE \*/}|${NEW_CONTENT}|" content/docs/releases.mdx
- name: Push changes
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git remote set-url origin https://x-access-token:${{ secrets.PAT_PUSH }}@github.com/gitbutlerapp/gitbutler-docs
git commit -am "[automated]: add release ${{ github.event.release.tag_name }}"
git push