Skip to content

Commit

Permalink
Merge pull request #68 from sandialabs/automate-releases
Browse files Browse the repository at this point in the history
Automate releases
  • Loading branch information
jmgate authored Jul 10, 2024
2 parents 61496db + f883a81 commit 0c198e1
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 5 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Semantic Release

on:
push:
branches:
- master

permissions:
contents: read

jobs:
release:
runs-on: ubuntu-latest
concurrency: release
environment: release
permissions:
id-token: write

steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@3ba53469e72452e7597dd5c61851e6fbf294420b # master
with:
github_token: ${{ secrets.GH_TOKEN }}

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # release/v1
if: steps.release.outputs.released == 'true'

- name: Publish to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@fe6cc89b43d8cbf0f9ce3285df3f77ff69c9b5d4 # main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GH_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
![Platforms](https://anaconda.org/conda-forge/shell-logger/badges/platforms.svg)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![pre-commit.ci Status](https://results.pre-commit.ci/badge/github/sandialabs/shell-logger/master.svg)](https://results.pre-commit.ci/latest/github/sandialabs/shell-logger/master)
[![PyPI - Version](https://img.shields.io/pypi/v/shell-logger?label=PyPI)](https://pypi.org/project/shell-logger/)
![PyPI - Downloads](https://img.shields.io/pypi/dm/shell-logger?label=PyPI%20downloads)
[![PyPI - Version](https://img.shields.io/pypi/v/shell-logger-sandialabs?label=PyPI)](https://pypi.org/project/shell-logger-sandialabs/)
![PyPI - Downloads](https://img.shields.io/pypi/dm/shell-logger-sandialabs?label=PyPI%20downloads)
![Python Version](https://img.shields.io/badge/Python-3.8|3.9|3.10|3.11|3.12-blue.svg)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

Expand Down
6 changes: 3 additions & 3 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ shell-logger
:target: https://github.com/pre-commit/pre-commit
.. |pre-commit.ci Status| image:: https://results.pre-commit.ci/badge/github/sandialabs/shell-logger/master.svg
:target: https://results.pre-commit.ci/latest/github/sandialabs/shell-logger/master
.. |PyPI Version| image:: https://img.shields.io/pypi/v/shell-logger?label=PyPI
:target: https://pypi.org/project/shell-logger/
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/shell-logger?label=PyPI%20downloads
.. |PyPI Version| image:: https://img.shields.io/pypi/v/shell-logger-sandialabs?label=PyPI
:target: https://pypi.org/project/shell-logger-sandialabs/
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/shell-logger-sandialabs?label=PyPI%20downloads
.. |Python Version| image:: https://img.shields.io/badge/Python-3.8|3.9|3.10|3.11|3.12-blue.svg
.. |Ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
Expand Down
11 changes: 11 additions & 0 deletions templates/.release_notes.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% for type_, commits in release["elements"] | dictsort %}
### {{ type_ | capitalize if type_ != "ci" else "Continuous Integration" }}
{%- if type_ != "unknown" %}
{% for commit in commits -%}
{%- set summary = commit.message.rstrip().splitlines()[0] -%}
{%- set details = commit.message.rstrip().splitlines()[2:] -%}
* {{ summary }} ([`{{ commit.hexsha[:7] }}`]({{ commit.hexsha | commit_hash_url }}))
{% if details %}
{% for line in details %}{% if line.strip() %} {{ line }}{% endif %}
{% endfor %}{% endif -%}
{% endfor %}{% endif %}{% endfor %}
15 changes: 15 additions & 0 deletions templates/CHANGELOG.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# CHANGELOG


{% for version, release in context.history.released.items() %}
## {{ version.as_tag() }} ({{ release.tagged_date.strftime("%Y-%m-%d") }})
{% for type_, commits in release["elements"] | dictsort %}
### {{ type_ | capitalize if type_ != "ci" else "Continuous Integration" }}
{% for commit in commits -%}
{%- set summary = commit.message.rstrip().splitlines()[0] -%}
{%- set details = commit.message.rstrip().splitlines()[2:] -%}
* {{ summary }} ([`{{ commit.hexsha[:7] }}`]({{ commit.hexsha | commit_hash_url }}))
{% if details %}
{% for line in details %}{% if line.strip() %} {{ line }}{% endif %}
{% endfor %}{% endif -%}
{% endfor %}{% endfor %}{% endfor %}

0 comments on commit 0c198e1

Please sign in to comment.