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
79 changes: 62 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
name: CI

on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
ci:
if: ${{ !cancelled() && ! failure() }}
Expand Down Expand Up @@ -36,24 +47,24 @@ jobs:
# renovate: github-runner
- windows-2022
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- '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"
python-version: '3.8'
# renovate: github-runner
- os: macos-14
python-version: "3.9"
python-version: '3.9'
include:
- os: macos-13
python-version: "3.8"
python-version: '3.8'
- os: macos-13
python-version: "3.9"
python-version: '3.9'
consistency:
if: ${{ !cancelled() && ! failure() }}
runs-on: ubuntu-22.04
Expand All @@ -69,11 +80,45 @@ jobs:
- run: git diff
- run: git status --porcelain
- run: test -z "$(git status --porcelain)"
on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main
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@a0de6af83968303c8c955486bf9739a57d23c7f1 # v1.10.0
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
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@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
-p conventional-changelog-conventionalcommits@7
-p semantic-release@23
semantic-release
78 changes: 25 additions & 53 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
name: Release

on:
release:
types:
- published

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
pages-build:
runs-on: ubuntu-22.04
Expand All @@ -9,7 +19,7 @@ jobs:
- uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
cache: true
python-version: "3.12"
python-version: '3.12'
version: 2.15.2
- id: pages
name: Setup pages
Expand All @@ -19,42 +29,22 @@ jobs:
- run: make doc
env:
CI_PAGES_URL: ${{ steps.pages.outputs.base_url }}
- name: Generate release notes
run: make release-notes > release-notes.md
- name: Upload release notes
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: release-notes
path: release-notes.md
- name: Upload pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: public
release-publish:
needs: pages-build
pages:
needs:
- pages-build
permissions:
contents: write
id-token: write
pages: write
runs-on: ubuntu-22.04
steps:
- name: Download release notes
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: release-notes
- id: prerelease
name: Determine prerelease
run: |
if [[ "${{ github.ref }}" =~ (a|b|rc)(0|[1-9][0-9]*)?$ ]]; then
echo "is_prerelease=true" > $GITHUB_OUTPUT
else
echo "is_prerelease=false" > $GITHUB_OUTPUT
fi
- name: Create GitHub release
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # v2.0.5
with:
body_path: release-notes.md
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
container-publish:
needs: release-publish
permissions:
packages: write
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -90,40 +80,22 @@ jobs:
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
package-publish:
needs: release-publish
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: pdm-project/setup-pdm@568ddd69406b30de1774ec0044b73ae06e716aa4 # v4
with:
cache: true
python-version: "3.12"
python-version: '3.12'
version: 2.15.2
- run: env | sort
- env:
PDM_PUBLISH_PASSWORD: ${{ secrets.PDM_PUBLISH_PASSWORD }}
PDM_PUBLISH_USERNAME: ${{ vars.PDM_PUBLISH_USERNAME || '__token__' }}
run: make publish
pages:
needs: release-publish
permissions:
id-token: write
pages: write
runs-on: ubuntu-22.04
steps:
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
on:
push:
tags:
- v?[0-9]+.[0-9]+.[0-9]+
- v?[0-9]+.[0-9]+.[0-9]+-?a[0-9]*
- v?[0-9]+.[0-9]+.[0-9]+-?b[0-9]*
- v?[0-9]+.[0-9]+.[0-9]+-?rc[0-9]*
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"automodule",
"cobertura",
"commitlint",
"conventionalcommits",
"datasource",
"deepclean",
"deflist",
Expand Down
118 changes: 118 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,123 @@
"extends": [
"@commitlint/config-conventional"
]
},
"release": {
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"type": "build",
"release": false
},
{
"type": "chore",
"release": false
},
{
"type": "ci",
"release": false
},
{
"type": "docs",
"release": false
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "perf",
"release": "patch"
},
{
"type": "refactor",
"release": "patch"
},
{
"type": "revert",
"release": "patch"
},
{
"type": "style",
"release": false
},
{
"type": "test",
"release": false
},
{
"scope": "*no-release*",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"presetConfig": {
"types": [
{
"type": "build",
"section": "Build"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "ci",
"section": "Continuous Integration"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance"
},
{
"type": "refactor",
"section": "Refactor"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/github"
],
"preset": "conventionalcommits"
}
}
1 change: 1 addition & 0 deletions template/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"automodule",
"cobertura",
"commitlint",
"conventionalcommits",
"datasource",
"deepclean",
"deflist",
Expand Down
Loading