feat: initial common-repo source template for semantic releases
Includes: - .releaserc.yaml (conventionalcommits preset, changelog, git, github, major-tag) - commitlint.config.js (@commitlint/config-conventional) - .github/workflows/commitlint.yml (PR commit linting via wagoid/commitlint-github-action) - .github/workflows/release.yaml (semantic-release on push to main, GitHub App token auth) - .common-repo.yaml (source-level excludes for README, LICENSE, self-config)
This commit is contained in:
20
.github/workflows/commitlint.yml
vendored
Normal file
20
.github/workflows/commitlint.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: Commitlint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
commitlint:
|
||||
name: Lint Commits
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548c61b7286b4ffe7cb3d # v6
|
||||
70
.github/workflows/release.yaml
vendored
Normal file
70
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: CI
|
||||
permissions:
|
||||
issues: write
|
||||
contents: write
|
||||
pull-requests: write
|
||||
uses: ./.github/workflows/ci.yaml
|
||||
secrets: inherit
|
||||
|
||||
release:
|
||||
name: Release
|
||||
needs: ci
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate app token
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@v1
|
||||
with:
|
||||
app-id: ${{ vars.CHRISTMAS_ISLAND_APP_ID }}
|
||||
private-key: ${{ secrets.CHRISTMAS_ISLAND_PRIVATE_KEY }}
|
||||
owner: christmas-island
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
persist-credentials: true
|
||||
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
|
||||
with:
|
||||
cache: npm
|
||||
cache-dependency-path: ".releaserc.yaml"
|
||||
node-version: lts/*
|
||||
- name: Semantic Release
|
||||
id: release
|
||||
run: |
|
||||
# Semantic Release
|
||||
npm install --no-save --no-package-lock \
|
||||
"@semantic-release/commit-analyzer" \
|
||||
"@semantic-release/release-notes-generator" \
|
||||
"@semantic-release/changelog" \
|
||||
"@semantic-release/git" \
|
||||
"@semantic-release/github" \
|
||||
"semantic-release-major-tag" \
|
||||
"conventional-changelog-conventionalcommits"
|
||||
npx semantic-release > release.log 2>&1 || true
|
||||
cat release.log
|
||||
if grep -q "There are no relevant changes, so no new version is released." release.log; then
|
||||
echo "publish=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "publish=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
outputs:
|
||||
publish: ${{ steps.release.outputs.publish }}
|
||||
Reference in New Issue
Block a user