chore: watch docs and template (#650) #336
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
ci: | |
if: ${{ !cancelled() && ! failure() }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- name: Set up PDM | |
uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4 | |
with: | |
cache: true | |
python-version: ${{ matrix.python-version }} | |
version: 2.16.1 | |
- run: env | sort | |
- run: make prerequisites | |
- run: make dev | |
- run: make lint test doc build | |
strategy: | |
matrix: | |
os: | |
# renovate: github-runner | |
- macos-14 | |
# renovate: github-runner | |
- ubuntu-22.04 | |
# renovate: github-runner | |
- windows-2022 | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
# Python 3.8 and 3.9 do not run on macos-14 which is using arm64 hardware. | |
exclude: | |
# renovate: github-runner | |
- os: macos-14 | |
python-version: '3.8' | |
# renovate: github-runner | |
- os: macos-14 | |
python-version: '3.9' | |
include: | |
- os: macos-13 | |
python-version: '3.8' | |
- os: macos-13 | |
python-version: '3.9' | |
consistency: | |
if: ${{ !cancelled() && ! failure() }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- run: env | sort | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Git | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email github-actions@github.com | |
- run: pipx install copier==9.3.1 | |
- run: make template-build | |
- run: git diff | |
- run: git status --porcelain | |
- run: test -z "$(git status --porcelain)" | |
semantic-release: | |
name: Semantic Release | |
runs-on: ubuntu-22.04 | |
# Avoid semantic release for forked repository | |
if: github.event_name != 'pull_request' && github.repository == 'serious-scaffold/ss-python' | |
permissions: | |
contents: write | |
id-token: write | |
issues: write | |
pull-requests: write | |
needs: | |
- ci | |
- consistency | |
steps: | |
- id: generate-token | |
name: Generate a token with GitHub App if App ID exists | |
if: vars.BOT_APP_ID | |
uses: actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4 # v1.10.3 | |
with: | |
app-id: ${{ vars.BOT_APP_ID }} | |
private-key: ${{ secrets.BOT_PRIVATE_KEY }} | |
- name: Warn if use GITHUB_TOKEN | |
run: | | |
if [ -z "${{ steps.generate-token.outputs.token || secrets.PAT }}" ]; then | |
echo "# :warning: GITHUB_TOKEN is used for semantic-release" >> $GITHUB_STEP_SUMMARY | |
echo "The GITHUB_TOKEN is used instead of a bot token or PAT and will not emit the released publish event for the released workflow." >> $GITHUB_STEP_SUMMARY | |
fi | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Setup Node.js | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: 'lts/*' | |
- name: Semantic Release | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token || secrets.PAT || secrets.GITHUB_TOKEN }} | |
run: > | |
npx | |
--package conventional-changelog-conventionalcommits@8.0.0 | |
--package semantic-release@24.0.0 | |
semantic-release |