Reorganize packages #132
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: main | |
on: [push, pull_request] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
fail-fast: false | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
runs-on: ${{ matrix.os }} | |
steps: | |
- run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- run: deno task test --coverage=.cov --junit-path=.test-report.xml | |
- uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: runner.os == 'Linux' && always() | |
with: | |
check_name: "Test Results (Linux)" | |
files: .test-report.xml | |
- uses: EnricoMi/publish-unit-test-result-action/macos@v2 | |
if: runner.os == 'macOS' && always() | |
with: | |
check_name: "Test Results (macOS)" | |
files: .test-report.xml | |
- uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
if: runner.os == 'Windows' && always() | |
with: | |
check_name: "Test Results (Windows)" | |
files: .test-report.xml | |
- if: '!cancelled()' | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: .test-report.xml | |
- run: deno coverage --lcov .cov > .cov.lcov | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: dahlia/logtape | |
file: .cov.lcov | |
- run: deno task test-all:bun | |
- run: deno task check | |
publish: | |
needs: [test] | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.x | |
- if: github.ref_type == 'branch' | |
run: | | |
v="$(jq \ | |
--raw-output \ | |
--arg build "$GITHUB_RUN_NUMBER" \ | |
--arg commit "${GITHUB_SHA::8}" \ | |
'.version + "-dev." + $build + "+" + $commit' \ | |
logtape/deno.json)" | |
deno run --allow-read --allow-write scripts/update_versions.ts "$v" | |
deno task check:versions | |
- if: github.ref_type == 'tag' | |
run: | | |
set -ex | |
[[ "$(jq -r .version logtape/deno.json)" = "$GITHUB_REF_NAME" ]] | |
deno task check:versions | |
- run: deno task dnt-all | |
- if: github.event_name == 'push' | |
run: | | |
set -ex | |
npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN" | |
for npm in */npm/; do | |
pushd "$npm" | |
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then | |
npm publish --provenance --access public | |
else | |
npm publish --provenance --access public --tag dev | |
fi | |
popd | |
done | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- if: github.event_name == 'pull_request' | |
run: deno task publish --dry-run --allow-dirty | |
- if: github.event_name == 'push' | |
run: deno task publish --allow-dirty | |
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@v2 | |
with: | |
bun-version: latest | |
- run: | | |
set -ex | |
bun install | |
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then | |
bun add -D "@logtape/logtape@$GITHUB_REF_NAME" | |
bun add -D "@logtape/file@$GITHUB_REF_NAME" | |
bun add -D @logtape/otel@latest | |
EXTRA_NAV_TEXT=Unstable \ | |
EXTRA_NAV_LINK="$UNSTABLE_DOCS_URL" \ | |
bun run build | |
else | |
bun add -D @logtape/logtape@dev | |
bun add -D @logtape/file@dev | |
bun add -D @logtape/otel@dev | |
EXTRA_NAV_TEXT=Stable \ | |
EXTRA_NAV_LINK="$STABLE_DOCS_URL" \ | |
bun run build | |
fi | |
env: | |
STABLE_DOCS_URL: ${{ vars.STABLE_DOCS_URL }} | |
UNSTABLE_DOCS_URL: ${{ vars.UNSTABLE_DOCS_URL }} | |
PLAUSIBLE_DOMAIN: ${{ secrets.PLAUSIBLE_DOMAIN }} | |
working-directory: ${{ github.workspace }}/docs/ | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/.vitepress/dist | |
- id: deployment | |
if: github.ref_type == 'tag' | |
uses: actions/deploy-pages@v4 | |
- if: 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 |