licensing: change project to MIT license #318
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: Continuous Integration | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v2 | |
- run: deno task lint | |
test-1: | |
name: Test (1st pass) | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v2 | |
- run: deno task install:deno | |
- run: deno task test:deno | |
test-2: | |
name: Test (2nd pass) | |
runs-on: ${{ matrix.os }} | |
needs: | |
- lint | |
- test-1 | |
permissions: | |
contents: read | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
runtime: | |
- name: deno | |
version: 2.x | |
- name: node | |
version: 22.x | |
- name: bun | |
# https://github.com/oven-sh/setup-bun/issues/37 | |
# version: 1.x | |
version: latest | |
exclude: | |
# https://github.com/oven-sh/bun/issues/5835 | |
- os: windows-latest | |
runtime: | |
name: bun | |
version: latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v2 | |
- if: matrix.runtime.name == 'deno' | |
uses: denoland/setup-deno@v2 | |
with: | |
deno-version: ${{ matrix.runtime.version }} | |
- if: matrix.runtime.name == 'node' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.runtime.version }} | |
- if: matrix.runtime.name == 'bun' | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: ${{ matrix.runtime.version }} | |
- run: deno task install:${{ matrix.runtime.name }} | |
- run: deno task test:${{ matrix.runtime.name }} | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: | |
- test-1 | |
- test-2 | |
steps: | |
- run: sleep 0 | |
codeql: | |
name: Code quality | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test-1 | |
permissions: | |
security-events: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: github/codeql-action/init@v3 | |
with: | |
languages: typescript | |
- uses: github/codeql-action/analyze@v3 | |
preview: | |
name: Preview | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test-1 | |
permissions: | |
id-token: write | |
contents: read | |
environment: | |
name: preview | |
url: ${{ steps.preview.outputs.url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v2 | |
- run: deno task ci:setup-deno-deploy | |
id: setup_github_actions | |
- run: deno task install:deno | |
- uses: denoland/deployctl@v1 | |
id: preview | |
# https://github.com/denoland/deployctl/issues/350 | |
with: | |
project: ${{ steps.setup_github_actions.outputs.project }} | |
entrypoint: ${{ steps.setup_github_actions.outputs.entrypoint }} | |
import-map: ${{ steps.setup_github_actions.outputs.import_map }} | |
include: ${{ steps.setup_github_actions.outputs.include }} | |
exclude: ${{ steps.setup_github_actions.outputs.exclude }} | |
autogenerate: | |
name: Autogenerate | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
- codeql | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: autogenerated | |
with: | |
app-id: 1090539 | |
private-key: ${{ secrets.AUTOGENERATED_CONTENT_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.autogenerated.outputs.token }} | |
- uses: denoland/setup-deno@v2 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- run: deno task ci:bump-versions | |
- run: deno task ci:autogenerate | |
- name: Run git push | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git config user.name 'github-actions[bot]' | |
git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git diff | |
git add . | |
git commit -m 'ci: autogenerated changes [skip ci]' | |
git pull --rebase | |
git push | |
fi | |
publish: | |
name: Publish | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: | |
- autogenerate | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v2 | |
- run: deno publish | |
deploy: | |
name: Deploy | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: | |
- preview | |
- publish | |
permissions: | |
id-token: write | |
pages: write | |
environment: | |
name: deployment | |
url: ${{ steps.deployment.outputs.url }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- uses: actions/configure-pages@v5 | |
- uses: denoland/setup-deno@v2 | |
- run: deno task ci:setup-github-pages | |
- uses: actions/upload-pages-artifact@v3 | |
- uses: actions/deploy-pages@v4 | |
id: deployment |