test: fix #1344
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: Sync `documentation` directory to ReadMe | |
# Run workflow for every push | |
on: push | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
- name: Install and build rdme deps | |
run: npm ci && npm run build | |
# Let's dynamically update our docs with the latest version of rdme! | |
# Note that these next three steps are not required | |
# in order to sync your docs to ReadMe. | |
# First, we run a script that sets a few outputs: | |
# our package version and our Node.js version. | |
- name: Retrieve version values | |
id: rdme-version | |
run: ./bin/set-version-output.js | |
# Next, we use this output to do a few find/replaces! | |
- name: Find and replace Node.js version placeholders | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: 'NODE_VERSION' | |
replace: ${{ steps.rdme-version.outputs.NODE_VERSION }} | |
regex: false | |
include: documentation/* | |
- name: Find and replace `rdme` version placeholders | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: 'RDME_VERSION' | |
replace: ${{ steps.rdme-version.outputs.RDME_VERSION }} | |
regex: false | |
include: documentation/* | |
# For every GitHub Action release, we deploy our Docker images | |
# to the GitHub Container Registry for performance reasons. | |
# Instead of testing against the pre-built image, we can build | |
# an image from the currently checked-out repo contents by doing a | |
# li'l update in the action.yml file to point to the current Dockerfile. | |
- name: Replace Docker image value in action.yml | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: 'image:.*' | |
replace: "image: 'Dockerfile'" | |
include: action.yml | |
# And finally, with our updated documentation, | |
# we run the `rdme` GitHub Action to sync the Markdown file | |
# in the `documentation` directory. | |
# Here's the page we're syncing: https://docs.readme.com/docs/rdme | |
# First we're going to perform a dry run of syncing process. | |
# We do this on every push to ensure that an actual sync will work properly | |
- name: Sync docs to ReadMe (dry run) | |
uses: ./ | |
with: | |
rdme: docs ./documentation --key=${{ secrets.README_DEVELOPERS_API_KEY }} --version=${{ vars.README_DEVELOPERS_MAIN_VERSION }} --dryRun | |
# And finally, we perform an actual sync to ReadMe if we're on the main branch | |
- name: Sync docs to ReadMe | |
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' | |
# We use the `main` branch as ref for GitHub Action | |
# This is NOT recommended, as it can break your workflows without notice! | |
# We recommend specifying a fixed version, i.e. @8.0.0 | |
# Docs: https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#example-using-versioned-actions | |
uses: readmeio/rdme@main | |
with: | |
rdme: docs ./documentation --key=${{ secrets.README_DEVELOPERS_API_KEY }} --version=${{ vars.README_DEVELOPERS_MAIN_VERSION }} |