Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: check continuous release testing #82

Merged
merged 13 commits into from
Oct 30, 2024
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
11 changes: 7 additions & 4 deletions .github/workflows/continuous-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ on:
- src/**
- tests/**
- setup.py
- .github/workflows/continuous-testing.yml
- pyproject.toml
- .github/workflows/*
pull_request:

permissions:
contents: read

jobs:
quick-test:
uses: sandialabs/sansmic/.github/workflows/pytest-workflow.yml@7952e59342a8c8d1c8ad833121049bac58277167
uses: dbhart/sansmic-workflows/.github/workflows/pytest.yaml@main
with:
version: "3.12"
os: ubuntu-latest
verbose: true
secrets:
coverage_token: ${{ secrets.CODECOV_TOKEN }}

check-release:
uses: dbhart/sansmic-workflows/.github/workflows/release.yaml@main
24 changes: 18 additions & 6 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,32 @@ jobs:
run: |
git checkout -B ${{ github.ref_name }} ${{ github.sha }}

- name: Setup | Get short commit SHA
id: vars
run: |
echo "short_sha=$(git rev-parse --short HEAD)\n" >> $GITHUB_OUTPUT

- name: Action | Check if release is needed
id: release
id: check
# Adjust tag with desired version if applicable.
uses: python-semantic-release/python-semantic-release@c1bcfdbb994243ac7cf419365d5894d6bfb2950e # v9.12.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "[email protected]"
root_options: -vv --noop
build: false
changelog: false
changelog: true
commit: false
push: false
tag: false
vcs_release: false
# prerelease: true
# build_metadata: ${{ github.ref_name }}@${{ steps.vars.outputs.short_sha }}

- name: Action | Semantic Release - Update version
if: steps.release.outputs.released == 'true'
id: release
if: steps.check.outputs.released == 'true'
# Adjust tag with desired version if applicable.
uses: python-semantic-release/python-semantic-release@c1bcfdbb994243ac7cf419365d5894d6bfb2950e # v9.12.0
with:
Expand All @@ -62,18 +71,21 @@ jobs:
changelog: true
commit: true
push: true
tag: false
tag: true
vcs_release: false
prerelease: true
prerelease_token: rc
build_metadata: ${{ steps.vars.outputs.short_sha }}

- name: Action | Create Pull Request - Release
if: steps.release.outputs.released == 'true'
if: steps.check.outputs.released == 'true'
run: |
gh pr create -B main -H staging --title "release: Merge into main and create tag as v${{ steps.release.outputs.version }}" --body 'Created by Github action: semantic-release.yml'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Action | Create Pull Request - Chore
if: steps.release.outputs.released == 'false'
if: steps.check.outputs.released == 'false'
run: |
gh pr create -B main -H staging --title 'chore: Merge non-code changes into main' --body 'Created by Github action: semantic-release.yml'
env:
Expand Down
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,22 @@ version_variables = [
"docs/conf.py:version",
]

[tool.semantic_release.branches.main]
match = "(main|master|staging)"
prerelease_token = "rc"
[tool.semantic_release.branches.release]
match = "main"
prerelease = false

[tool.semantic_release.branches.merge]
match = "[0-9]+/merge"
[tool.semantic_release.branches.candidate]
match = "staging"
prerelease_token = "rc"
prerelease = false
prerelease = true

[tool.semantic_release.branches.check-only]
match = "(?!main|master|staging)"

[tool.semantic_release.changelog]
template_dir = "templates"
changelog_file = "CHANGELOG.md"
exclude_commit_patterns = ["build", "ci", "chore", "^Bump", "release", "^Merge branch"]
default_templates.changelog_file = "CHANGELOG.md"
exclude_commit_patterns = ["build", "ci", "chore", "^Bump", "release", "style", "^Merge branch"]

[tool.semantic_release.changelog.environment]
block_start_string = "{%"
Expand Down