Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,70 @@ permissions:
on:
push:
tags:
- "v*"
- "v*.*.*"
workflow_dispatch:

jobs:
resolve:
if: github.event_name == 'push'
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.resolve.outputs.tag }}
sha: ${{ steps.resolve.outputs.sha }}
version: ${{ steps.resolve.outputs.version }}
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
# renovate: datasource=github-releases depName=oven-sh/bun
bun-version: "1.3.14"
no-cache: true
- name: Resolve release tag
id: resolve
env:
RELEASE_TAG: ${{ github.ref_name }}
RELEASE_SHA: ${{ github.sha }}
run: |
bun scripts/release-tag.ts resolve "$RELEASE_TAG" "$RELEASE_SHA"
{
echo "tag=$RELEASE_TAG"
echo "sha=$RELEASE_SHA"
echo "version=${RELEASE_TAG#v}"
} >> "$GITHUB_OUTPUT"
publish:
needs: resolve
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
ref: ${{ needs.resolve.outputs.sha }}
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
# renovate: datasource=github-releases depName=oven-sh/bun
bun-version: "1.3.14"
no-cache: true
- run: bun install --frozen-lockfile
- run: bun run lint
- run: bun run typecheck
- run: bun run test
- run: bun run build
- name: Resolve npm dist-tag from version
id: disttag
env:
VERSION: ${{ needs.resolve.outputs.version }}
run: |
version=$(node -p "require('./package.json').version")
if [[ "$version" == *-* ]]; then
if [[ "$VERSION" == *-* ]]; then
echo "tag=next" >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
- run: bun publish --access public --tag ${{ steps.disttag.outputs.tag }}
- run: bun publish --access public --tag "$NPM_TAG"
env:
NPM_TAG: ${{ steps.disttag.outputs.tag }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: release-tag
'on':
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
# renovate: datasource=github-releases depName=oven-sh/bun
bun-version: "1.3.14"
- name: Validate a changed release version
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: bun scripts/release-tag.ts check
mint:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
environment: main
steps:
- name: Require main-branch dispatch
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main'
run: |
echo '::error::workflow_dispatch is only allowed from main' >&2
exit 1
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
# renovate: datasource=github-releases depName=oven-sh/bun
bun-version: "1.3.14"
- name: Create scoped automation App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.AUTOMATION_APP_CLIENT_ID }}
private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}
permission-contents: write
repositories: solid-markdown
- name: Mint release tag if needed
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
RELEASE_SHA: ${{ github.sha }}
RELEASE_REPOSITORY: ${{ github.repository }}
run: bun scripts/release-tag.ts mint
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@
"dev": "vite serve dev",
"build": "bun run build.ts && bun run smoke",
"smoke": "bun run scripts/smoke-dist.ts",
"test": "bun run test:client && bun run test:ssr",
"test": "bun run test:client && bun run test:ssr && bun run test:release",
"test:client": "SOLID_GENERATE=dom bun --conditions=browser --conditions=development test test/client.test.tsx",
"test:ssr": "SOLID_GENERATE=ssr bun --conditions=development test test/server.test.tsx",
"test:release": "bun test test/release-tag.test.ts",
"typecheck": "tsc --noEmit",
"lint": "biome check .",
"format": "biome format --write ."
Expand Down
Loading
Loading