Skip to content

Relicense under Apache-2.0 license #19

Relicense under Apache-2.0 license

Relicense under Apache-2.0 license #19

Workflow file for this run

# 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/[email protected]
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: Get Changelog Information (Unreleased)
uses: ./
id: yaclog-show-unreleased
with:
changelog-path: 'tests/Test-Changelog-Unreleased.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' &&
steps.yaclog-show-unreleased.outputs.version == '0.13.1' &&
endsWith(steps.yaclog-show.outputs.changelog, 'tests/Test-Changelog.md') &&
hashFiles('body.md') == 'ad49b5c946b7d361db1c3dacc73de4f6222cca6272aab426786de168eede702b'
)
run: |
echo "Action self-test failed!"
echo "yaclog-show:\n ${{ toJSON(steps.yaclog-show.outputs) }}"
echo "yaclog-show-unreleased:\n${{ toJSON(steps.yaclog-show.outputs) }}"
echo "${{ hashFiles('body.md') }}"
false
build:
name: Build Distribution
needs:
- test
- test-action
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.12'
- 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/checkout@v4
- uses: actions/download-artifact@v4
with:
name: python-distribution
path: dist/
- name: Get Changelog Information
id: yaclog-show
uses: ./ # self-hosting!
- 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 }}"
dist/*
env:
GH_TOKEN: ${{ github.token }}