diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..73a2aca --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,20 @@ +name: fern-check + +on: + pull_request: + push: + branches: + - main + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Fern + run: npm install -g fern-api + + - name: Check API is valid + run: fern check diff --git a/.github/workflows/preview-docs.yml b/.github/workflows/preview-docs.yml new file mode 100644 index 0000000..ffc2164 --- /dev/null +++ b/.github/workflows/preview-docs.yml @@ -0,0 +1,30 @@ +name: preview-docs + +on: pull_request + +jobs: + run: + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Fern + run: npm install -g fern-api + + - name: Generate preview URL + id: generate-docs + env: + FERN_TOKEN: ${{ secrets.FERN_TOKEN }} + run: | + OUTPUT=$(fern generate --docs --preview 2>&1) || true + echo "$OUTPUT" + URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()') + echo "Preview URL: $URL" + echo "🌿 Preview your docs: $URL" > preview_url.txt + + - name: Comment URL in PR + uses: thollander/actions-comment-pull-request@v2.4.3 + with: + filePath: preview_url.txt diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml new file mode 100644 index 0000000..7b12e98 --- /dev/null +++ b/.github/workflows/publish-docs.yml @@ -0,0 +1,22 @@ +name: publish-docs + +on: + push: + branches: + - main + +jobs: + run: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/heads/main') && github.run_number > 1 }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Fern + run: npm install -g fern-api + + - name: Publish Docs + env: + FERN_TOKEN: ${{ secrets.FERN_TOKEN }} + run: fern generate --docs --log-level debug diff --git a/fern/workflows/check.yml b/fern/workflows/check.yml new file mode 100644 index 0000000..8dca65f --- /dev/null +++ b/fern/workflows/check.yml @@ -0,0 +1,20 @@ +name: fern-check + +on: + pull_request: + push: + branches: + - main + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Fern CLI tool + run: npm install -g fern-api + + - name: Check API is valid + run: fern check diff --git a/fern/workflows/preview-docs.yml b/fern/workflows/preview-docs.yml new file mode 100644 index 0000000..55ef1ef --- /dev/null +++ b/fern/workflows/preview-docs.yml @@ -0,0 +1,30 @@ +name: preview-docs + +on: pull_request + +jobs: + run: + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Fern CLI tool + run: npm install -g fern-api + + - name: Generate preview URL + id: generate-docs + env: + FERN_TOKEN: ${{ secrets.FERN_TOKEN }} + run: | + OUTPUT=$(fern generate --docs --preview 2>&1) || true + echo "$OUTPUT" + URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()') + echo "Preview URL: $URL" + echo "🌿 Preview your docs: $URL" > preview_url.txt + + - name: Comment URL in PR + uses: thollander/actions-comment-pull-request@v2.4.3 + with: + filePath: preview_url.txt diff --git a/fern/workflows/publish-docs.yml b/fern/workflows/publish-docs.yml new file mode 100644 index 0000000..ad3cfea --- /dev/null +++ b/fern/workflows/publish-docs.yml @@ -0,0 +1,22 @@ +name: publish-docs + +on: + push: + branches: + - main + +jobs: + run: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/heads/main') && github.run_number > 1 }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Fern CLI tool + run: npm install -g fern-api + + - name: Publish Docs + env: + FERN_TOKEN: ${{ secrets.FERN_TOKEN }} + run: fern generate --docs --log-level debug