mirror of
https://github.com/drewcassidy/yaclog.git
synced 2024-09-01 14:58:58 +00:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
2a04aa00a8 | |||
fbcd178205 | |||
c37387360b | |||
fe8c38f62f | |||
d8ba08cc6a | |||
ad19a2b530 | |||
4f22d74721 | |||
a6259aa1b3 | |||
aad894fa08 | |||
e31a8d094e | |||
0ca8609bb7 | |||
394cac155f | |||
4d57ef2fb0 |
149
.github/workflows/build.yml
vendored
Normal file
149
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
# This workflow will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
||||
|
||||
name: build
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test Python Module
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
|
||||
click-version: [ "click~=8.0" ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5.1.1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install flake8
|
||||
python -m pip install ${{ matrix.click-version }}
|
||||
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
|
||||
- name: Install module
|
||||
run: python -m pip install .
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: python -m unittest -v
|
||||
|
||||
test-action:
|
||||
name: Test Github Action
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get Changelog Information
|
||||
uses: ./
|
||||
id: yaclog-show
|
||||
with:
|
||||
changelog-path: 'tests/Test-Changelog.md'
|
||||
|
||||
- name: Copy Body File
|
||||
run:
|
||||
cp ${{ steps.yaclog-show.outputs.body-file }} body.md
|
||||
|
||||
- name: Fail
|
||||
if: >
|
||||
!(
|
||||
steps.yaclog-show.outputs.name == '0.13.0 "Aquarius"' &&
|
||||
steps.yaclog-show.outputs.header == '## 0.13.0 "Aquarius" - 1970-04-11 [YANKED]' &&
|
||||
steps.yaclog-show.outputs.version == '0.13.0' &&
|
||||
endsWith(steps.yaclog-show.outputs.changelog, 'tests/Test-Changelog.md') &&
|
||||
hashFiles('body.md') == 'ad49b5c946b7d361db1c3dacc73de4f6222cca6272aab426786de168eede702b'
|
||||
)
|
||||
run: |
|
||||
echo "Action self-test failed!"
|
||||
echo "${{ toJSON(steps.yaclog-show.outputs) }}"
|
||||
echo "${{ hashFiles('body.md') }}"
|
||||
false
|
||||
|
||||
build:
|
||||
name: Build Distribution
|
||||
needs:
|
||||
- test
|
||||
- test-action
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
body-file: ${{ steps.yaclog-show.outputs.body-file }}
|
||||
version-name: ${{ steps.yaclog-show.outputs.name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.1
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Get Changelog Information
|
||||
id: yaclog-show
|
||||
uses: ./ # self-hosting!
|
||||
|
||||
- name: Install pypa/build
|
||||
run: python -m pip install build --user
|
||||
|
||||
- name: Build a binary wheel and source tarball
|
||||
run: python -m build --sdist --wheel --outdir dist/
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: python-distribution
|
||||
path: dist/
|
||||
compression-level: 0 # already compressed
|
||||
|
||||
publish-pypi:
|
||||
name: Deploy to PyPI
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
||||
needs: build
|
||||
runs-on: ubuntu-22.04
|
||||
environment:
|
||||
name: Publish
|
||||
url: https://pypi.org/project/yaclog/${{ github.ref_name }}
|
||||
permissions:
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: python-distribution
|
||||
path: dist/
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
||||
publish-github:
|
||||
name: Deploy to Github
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
||||
needs: build
|
||||
runs-on: ubuntu-22.04
|
||||
environment:
|
||||
name: Publish
|
||||
url: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: python-distribution
|
||||
path: dist/
|
||||
|
||||
- name: Publish to Github
|
||||
run: >
|
||||
gh release create ${{ github.ref_name }}
|
||||
--notes-file "${{ needs.build.outputs.body-file }}"
|
||||
--title "${{ needs.build.outputs.version-name }}"
|
||||
dist/*
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
86
.github/workflows/python-publish.yml
vendored
86
.github/workflows/python-publish.yml
vendored
@ -1,86 +0,0 @@
|
||||
# This workflow will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
||||
|
||||
name: build
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
|
||||
click-version: [ "click~=8.0" ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5.1.1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install flake8
|
||||
python -m pip install ${{ matrix.click-version }}
|
||||
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
|
||||
- name: Install module
|
||||
run: python -m pip install .
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: python -m unittest -v
|
||||
|
||||
- name: Run Action
|
||||
id: yaclog-show
|
||||
uses: ./
|
||||
|
||||
deploy:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/p/yaclog
|
||||
permissions:
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5.1.1
|
||||
with:
|
||||
python-version: '>=3.8'
|
||||
|
||||
- name: Install pypa/build
|
||||
run: python -m pip install build --user
|
||||
|
||||
- name: Build a binary wheel and source tarball
|
||||
run: python -m build --sdist --wheel --outdir dist/
|
||||
|
||||
- name: Get Changelog Information
|
||||
id: yaclog-show
|
||||
uses: ./
|
||||
# self-hosting!
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
||||
- name: Publish to Github
|
||||
run: |
|
||||
gh release create ${{ github.ref_name }} \
|
||||
--notes-file "${{ steps.yaclog-show.outputs.body_file }}" \
|
||||
--title "${{ steps.yaclog-show.outputs.name }}"
|
||||
|
||||
gh release upload ${{ github.ref_name }} dist/*
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -2,6 +2,17 @@
|
||||
|
||||
All notable changes to this project will be documented in this file
|
||||
|
||||
## Version 1.4.3 - 2024-08-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed package missing the cli module in some circumstances
|
||||
|
||||
### Changed
|
||||
|
||||
- Added the `body-file` output to the github action. `body_file` still exists but is aliased to `body-file`
|
||||
|
||||
|
||||
## Version 1.4.2 - 2024-08-27
|
||||
|
||||
### Fixed
|
||||
|
13
action.yaml
13
action.yaml
@ -28,9 +28,12 @@ outputs:
|
||||
version:
|
||||
description: "The current version number. For example, `1.3.0`"
|
||||
value: ${{ steps.yaclog-show.outputs.version }}
|
||||
body_file:
|
||||
body-file:
|
||||
description: "Path to a temporary file containing the version body"
|
||||
value: ${{ steps.yaclog-show.outputs.body_file }}
|
||||
value: ${{ steps.yaclog-show.outputs.body-file }}
|
||||
body_file:
|
||||
description: "Alias for body-file"
|
||||
value: ${{ steps.yaclog-show.outputs.body-file }}
|
||||
changelog:
|
||||
description: "Path to the entire changelog file."
|
||||
value: ${{ steps.yaclog-show.outputs.changelog }}
|
||||
@ -46,7 +49,11 @@ runs:
|
||||
|
||||
- name: Setup Yaclog
|
||||
shell: bash
|
||||
run: pipx install --python ${{ steps.setup-python.outputs.python-path }} ${{ github.action_path }}
|
||||
run: |
|
||||
[[ "$ACTION_REF" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && export SETUPTOOLS_SCM_PRETEND_VERSION_FOR_YACLOG="$ACTION_REF"
|
||||
pipx install --python ${{ steps.setup-python.outputs.python-path }} ${{ github.action_path }}
|
||||
env:
|
||||
ACTION_REF: ${{ github.action_ref }}
|
||||
|
||||
- name: Create New Release
|
||||
shell: bash
|
||||
|
@ -34,45 +34,6 @@ Tags are additional metadata added to a version header, denoted by all-caps text
|
||||
|
||||
## Example
|
||||
|
||||
```markdown
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## 0.13.0 "Aquarius" - 1970-04-11 [YANKED]
|
||||
|
||||
Yanked due to issues with oxygen tanks, currently investigating
|
||||
|
||||
### Added
|
||||
|
||||
- Extra propellant in preparation for future versions
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced Ken Mattingly
|
||||
- Stirred oxygen tanks
|
||||
|
||||
## 0.12.0 "Intrepid" - 1969-11-14
|
||||
|
||||
### Added
|
||||
|
||||
- New ALSEP package for surface science
|
||||
- Color cameras
|
||||
- Surface rendezvous with Surveyor 3
|
||||
|
||||
### Fixed
|
||||
|
||||
- 1201/1202 alarm distracting crew during landing
|
||||
|
||||
### Known Issues
|
||||
|
||||
- Lightning strike during launch: No effect on performance
|
||||
|
||||
## 0.11.0 "Eagle" - 1969-07-20
|
||||
|
||||
Initial stable release
|
||||
|
||||
### Changed
|
||||
|
||||
- Fully fueled lander to allow landing on the lunar surface
|
||||
```{literalinclude} ../../tests/Test-Changelog.md
|
||||
:language: markdown
|
||||
```
|
@ -46,7 +46,7 @@ The most recent version name, equivalent to the output of `yaclog show --name`.
|
||||
The entire header for the most recent version, equivalent to the output of `yaclog show --header`. For example, `Version 1.3.0 - 2024-08-08`
|
||||
```
|
||||
|
||||
```{confval} body_file
|
||||
```{confval} body-file
|
||||
The path to a temporary file containing the body of the most recent version. Contents equivalent to `yaclog show --body`
|
||||
```
|
||||
|
||||
@ -82,7 +82,7 @@ jobs:
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
|
||||
run: |
|
||||
gh release create {{ '${{ github.ref_name }}' }} \
|
||||
--notes-file "{{ '${{ steps.yaclog.outputs.body_file }}' }}" \
|
||||
--notes-file "{{ '${{ steps.yaclog.outputs.body-file }}' }}" \
|
||||
--title "{{ '${{ steps.yaclog.outputs.name }}' }}"
|
||||
env:
|
||||
GH_TOKEN: {{ '${{ github.token }}' }}
|
||||
|
@ -60,4 +60,4 @@ Docs = "https://yaclog.readthedocs.io/"
|
||||
fallback_version = "0.0.0"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["yaclog"]
|
||||
include = ["yaclog*"]
|
40
tests/Test-Changelog.md
Normal file
40
tests/Test-Changelog.md
Normal file
@ -0,0 +1,40 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## 0.13.0 "Aquarius" - 1970-04-11 [YANKED]
|
||||
|
||||
Yanked due to issues with oxygen tanks, currently investigating
|
||||
|
||||
### Added
|
||||
|
||||
- Extra propellant in preparation for future versions
|
||||
|
||||
### Changed
|
||||
|
||||
- Replaced Ken Mattingly
|
||||
- Stirred oxygen tanks
|
||||
|
||||
## 0.12.0 "Intrepid" - 1969-11-14
|
||||
|
||||
### Added
|
||||
|
||||
- New ALSEP package for surface science
|
||||
- Color cameras
|
||||
- Surface rendezvous with Surveyor 3
|
||||
|
||||
### Fixed
|
||||
|
||||
- 1201/1202 alarm distracting crew during landing
|
||||
|
||||
### Known Issues
|
||||
|
||||
- Lightning strike during launch: No effect on performance
|
||||
|
||||
## 0.11.0 "Eagle" - 1969-07-20
|
||||
|
||||
Initial stable release
|
||||
|
||||
### Changed
|
||||
|
||||
- Fully fueled lander to allow landing on the lunar surface
|
@ -123,7 +123,7 @@ def show(obj: Changelog, all_versions, markdown, mode, version_names, gh_actions
|
||||
body_fd, body_file = tempfile.mkstemp(text=True)
|
||||
with os.fdopen(body_fd, 'w') as f:
|
||||
f.write(sep.join([functions['body'](v, kwargs) for v in versions]))
|
||||
click.echo(f'body_file={body_file}')
|
||||
click.echo(f'body-file={body_file}')
|
||||
click.echo(f'changelog={obj.path}')
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user