Use a JSR version of Fedify for the blog example #416
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: build | |
on: [push, pull_request] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- run: deno task cache | |
working-directory: ${{ github.workspace }}/src/ | |
- run: deno task test --coverage=.cov --junit-path=.test-report.xml | |
env: | |
RUST_BACKTRACE: ${{ runner.debug }} | |
working-directory: ${{ github.workspace }}/src/ | |
- uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: runner.os == 'Linux' && always() | |
with: | |
check_name: "Test Results (Linux)" | |
files: src/.test-report.xml | |
- uses: EnricoMi/publish-unit-test-result-action/macos@v2 | |
if: runner.os == 'macOS' && always() | |
with: | |
check_name: "Test Results (macOS)" | |
files: src/.test-report.xml | |
- uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
if: runner.os == 'Windows' && always() | |
with: | |
check_name: "Test Results (Windows)" | |
files: src/.test-report.xml | |
- run: deno coverage --lcov .cov > .cov.lcov | |
working-directory: ${{ github.workspace }}/src/ | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: src/.cov.lcov | |
test-dnt: | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- run: deno task cache | |
working-directory: ${{ github.workspace }}/src/ | |
- run: deno task dnt | |
working-directory: ${{ github.workspace }}/src/ | |
- run: bun test_runner.js | |
working-directory: ${{ github.workspace }}/src/npm/ | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- run: deno task hooks:pre-commit | |
working-directory: ${{ github.workspace }}/src/ | |
- run: deno task check | |
working-directory: ${{ github.workspace }}/examples/blog/ | |
release-test: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- run: deno task publish --dry-run | |
working-directory: ${{ github.workspace }}/src/ | |
- run: deno task dnt | |
working-directory: ${{ github.workspace }}/src/ | |
- run: npm publish --dry-run | |
working-directory: ${{ github.workspace }}/src/npm/ | |
env: | |
DNT_SKIP_TEST: "true" | |
- run: deno task publish-dry-run | |
working-directory: ${{ github.workspace }}/cli/ | |
publish: | |
needs: [test, test-dnt, lint, release-test] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- if: github.ref_type == 'branch' | |
run: | | |
jq \ | |
--arg build "$GITHUB_RUN_NUMBER" \ | |
--arg commit "${GITHUB_SHA::8}" \ | |
'.version = .version + "-dev." + $build + "+" + $commit' \ | |
deno.json > deno.json.tmp | |
mv deno.json.tmp deno.json | |
working-directory: ${{ github.workspace }}/src/ | |
- if: github.ref_type == 'tag' | |
run: | | |
set -ex | |
[[ "$(jq -r .version deno.json)" = "$GITHUB_REF_NAME" ]] | |
! grep -i "to be released" CHANGES.md | |
working-directory: ${{ github.workspace }}/src/ | |
# Don't know why, but the .gitignore list is not overriden by include list | |
# in deno.json: | |
- run: rm vocab/.gitignore | |
working-directory: ${{ github.workspace }}/src/ | |
- run: 'deno task dnt "$(jq -r .version deno.json)"' | |
working-directory: ${{ github.workspace }}/src/ | |
env: | |
DNT_SKIP_TEST: "true" | |
- run: npm pack | |
working-directory: ${{ github.workspace }}/src/npm/ | |
- run: deno task pack | |
working-directory: ${{ github.workspace }}/cli/ | |
- run: 'deno task npm "$(jq -r .version deno.json)"' | |
working-directory: ${{ github.workspace }}/cli/ | |
- id: extract-changelog | |
uses: dahlia/submark@5a5ff0a58382fb812616a5801402f5aef00f90ce | |
with: | |
input-file: CHANGES.md | |
heading-level: 2 | |
heading-title-text: version ${{ github.ref_name }} | |
ignore-case: true | |
omit-heading: true | |
- run: 'cat "$CHANGES_FILE"' | |
env: | |
CHANGES_FILE: ${{ steps.extract-changelog.outputs.output-file }} | |
- if: github.event_name == 'push' && github.ref_type == 'tag' | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: ${{ steps.extract-changelog.outputs.output-file }} | |
name: Fedify ${{ github.ref_name }} | |
files: | | |
src/npm/*.tgz | |
cli/fedify-cli-* | |
generate_release_notes: false | |
- if: | | |
github.event_name == 'push' && | |
github.ref_type == 'tag' || github.ref == 'refs/heads/main' | |
run: deno task publish --allow-dirty | |
working-directory: ${{ github.workspace }}/src/ | |
- if: | | |
github.event_name == 'push' && | |
github.ref_type == 'tag' || github.ref == 'refs/heads/main' | |
run: deno task publish --allow-dirty | |
working-directory: ${{ github.workspace }}/cli/ | |
- if: | | |
github.event_name == 'push' && | |
github.ref_type == 'tag' || github.ref == 'refs/heads/main' | |
run: | | |
set -ex | |
npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN" | |
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then | |
npm publish --provenance --access public *.tgz | |
else | |
npm publish --provenance --access public --tag dev *.tgz | |
fi | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
working-directory: ${{ github.workspace }}/src/npm/ | |
- if: github.event_name == 'push' && github.ref_type == 'tag' | |
run: | | |
set -ex | |
npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN" | |
npm publish --provenance --access public fedify-cli-*.tgz | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
working-directory: ${{ github.workspace }}/cli/ | |
publish-examples-blog: | |
if: github.event_name == 'push' | |
needs: [test, lint] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- run: deno task codegen | |
working-directory: ${{ github.workspace }}/src/ | |
- uses: denoland/deployctl@v1 | |
with: | |
project: fedify-blog | |
entrypoint: ./examples/blog/main.ts | |
root: . | |
publish-docs: | |
if: github.event_name == 'push' | |
needs: [publish] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
pages: write | |
deployments: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- run: | | |
set -ex | |
bun install | |
if [[ "$GITHUB_EVENT_NAME" = "push" && "$GITHUB_REF_TYPE" = "tag" ]]; then | |
bun add -Df --no-cache "@fedify/fedify@$GITHUB_REF_NAME" | |
EXTRA_NAV_TEXT=Unstable \ | |
EXTRA_NAV_LINK="$UNSTABLE_DOCS_URL" \ | |
bun run build | |
else | |
bun add -Df --no-cache @fedify/fedify@dev | |
EXTRA_NAV_TEXT=Stable \ | |
EXTRA_NAV_LINK="$STABLE_DOCS_URL" \ | |
bun run build | |
fi | |
env: | |
PLAUSIBLE_DOMAIN: ${{ secrets.PLAUSIBLE_DOMAIN }} | |
STABLE_DOCS_URL: ${{ vars.STABLE_DOCS_URL }} | |
UNSTABLE_DOCS_URL: ${{ vars.UNSTABLE_DOCS_URL }} | |
working-directory: ${{ github.workspace }}/docs/ | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/.vitepress/dist | |
- id: deployment | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
uses: actions/deploy-pages@v4 | |
- if: github.event_name == 'pull_request' || github.ref_type == 'branch' | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: docs/.vitepress/dist | |
production-branch: main | |
github-token: ${{ github.token }} | |
enable-pull-request-comment: false | |
enable-commit-comment: false | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 2 |