Docs: Syncing config files with Deno Slack SDK and Slack CLI docs (#1… #75
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: Implement docs site | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'docs/**' | |
push: | |
branches: | |
- main | |
paths: | |
- 'docs/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Docusaurus | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
cache-dependency-path: docs/package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./docs | |
- name: Read version from docs/version-config.yml | |
id: read_version | |
run: | | |
sdkLatestVersionValue=$(grep 'sdkLatestVersion:' docs/version-config.yml | awk '{print $2}') | |
okhttpVersionValue=$(grep 'okhttpVersion:' docs/version-config.yml | awk '{print $2}') | |
slf4jApiVersionValue=$(grep 'slf4jApiVersion:' docs/version-config.yml | awk '{print $2}') | |
kotlinVersionValue=$(grep 'kotlinVersion:' docs/version-config.yml | awk '{print $2}') | |
helidonVersionValue=$(grep 'helidonVersion:' docs/version-config.yml | awk '{print $2}') | |
javaxWebsocketApiVersionValue=$(grep 'javaxWebsocketApiVersion:' docs/version-config.yml | awk '{print $2}') | |
springBootVersionValue=$(grep 'springBootVersion:' docs/version-config.yml | awk '{print $2}') | |
compatibleMicronautVersionValue=$(grep 'compatibleMicronautVersion:' docs/version-config.yml | awk '{print $2}') | |
quarkusVersionValue=$(grep 'quarkusVersion:' docs/version-config.yml | awk '{print $2}') | |
tyrusStandaloneClientVersionValue=$(grep 'tyrusStandaloneClientVersion:' docs/version-config.yml | awk '{print $2}') | |
tyrusStandaloneClientV2VersionValue=$(grep 'tyrusStandaloneClientV2Version:' docs/version-config.yml | awk '{print $2}') | |
jakartaWebsocketApiVersionValue=$(grep 'jakartaWebsocketApiVersion:' docs/version-config.yml | awk '{print $2}') | |
echo "sdkLatestVersion=$sdkLatestVersionValue" >> $GITHUB_ENV | |
echo "okhttpVersion=$okhttpVersionValue" >> $GITHUB_ENV | |
echo "slf4jApiVersion=$slf4jApiVersionValue" >> $GITHUB_ENV | |
echo "kotlinVersion=$kotlinVersionValue" >> $GITHUB_ENV | |
echo "helidonVersion=$helidonVersionValue" >> $GITHUB_ENV | |
echo "javaxWebsocketApiVersion=$javaxWebsocketApiVersionValue" >> $GITHUB_ENV | |
echo "springBootVersion=$springBootVersionValue" >> $GITHUB_ENV | |
echo "compatibleMicronautVersion=$compatibleMicronautVersionValue" >> $GITHUB_ENV | |
echo "quarkusVersion=$quarkusVersionValue" >> $GITHUB_ENV | |
echo "tyrusStandaloneClientVersion=$tyrusStandaloneClientVersionValue" >> $GITHUB_ENV | |
echo "tyrusStandaloneClientV2Version=$tyrusStandaloneClientV2VersionValue" >> $GITHUB_ENV | |
echo "jakartaWebsocketApiVersion=$jakartaWebsocketApiVersionValue" >> $GITHUB_ENV | |
- name: Replace placeholders in .md files | |
run: | | |
for DOCS_DIR in "./docs/content" "./docs/i18n/ja-jp/docusaurus-plugin-content-docs/current"; do | |
find $DOCS_DIR -name "*.md" | while read file; do | |
sed -i "s/sdkLatestVersion/${{ env.sdkLatestVersion }}/g" "$file" | |
sed -i "s/okhttpVersion/${{ env.okhttpVersion }}/g" "$file" | |
sed -i "s/slf4jApiVersion/${{ env.slf4jApiVersion }}/g" "$file" | |
sed -i "s/kotlinVersion/${{ env.kotlinVersion }}/g" "$file" | |
sed -i "s/helidonVersion/${{ env.helidonVersion }}/g" "$file" | |
sed -i "s/javaxWebsocketApiVersion/${{ env.javaxWebsocketApiVersion }}/g" "$file" | |
sed -i "s/springBootVersion/${{ env.springBootVersion }}/g" "$file" | |
sed -i "s/compatibleMicronautVersion/${{ env.compatibleMicronautVersion }}/g" "$file" | |
sed -i "s/quarkusVersion/${{ env.quarkusVersion }}/g" "$file" | |
sed -i "s/tyrusStandaloneClientVersion/${{ env.tyrusStandaloneClientVersion }}/g" "$file" | |
sed -i "s/tyrusStandaloneClientV2Version/${{ env.tyrusStandaloneClientV2Version }}/g" "$file" | |
sed -i "s/jakartaWebsocketApiVersion/${{ env.jakartaWebsocketApiVersion }}/g" "$file" | |
done | |
done | |
- name: Build website | |
run: npm run build | |
working-directory: ./docs | |
- name: Upload Build Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./docs/build | |
deploy: | |
name: Deploy to GitHub Pages | |
if: github.event_name != 'pull_request' | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # verifies deployment is from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |