Add solution builder script (#9) #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'README.md' | |
- 'Contributing.md' | |
jobs: | |
build: | |
name: Build and release distribution 📦 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: 'pip' | |
- name: Install pypa/build | |
run: >- | |
python3 -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: python3 -m build | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ib_cicd_dist | |
path: dist/ | |
- name: Install package version reader | |
# Installs dasel into the environment for clean parsing of the pyproject.toml configuration | |
# Project lives at https://github.com/TomWright/dasel | |
# Installation instructions that this is taken from | |
# live at https://daseldocs.tomwright.me/installation#manual | |
run: >- | |
curl -sSLf | |
"$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" | |
-L -o dasel | |
&& chmod +x dasel | |
- name: Set package version | |
# Get the Python package version from the pyproject.toml | |
# and set it under python-package-version.PYTHON_PKG_VERSION for later use | |
id: python-package-version | |
run: >- | |
echo | |
"PYTHON_PKG_VERSION=$(cat pyproject.toml | ./dasel -r toml '.project.version' | tr -d "'")" | |
>> "$GITHUB_OUTPUT" | |
- name: Get package path | |
# Get the path to the built .whl file | |
# and set it under python-package-path.PYTHON_PKG_PATH for later use | |
id: python-package-path | |
run: >- | |
echo | |
"PYTHON_PKG_PATH=$(ls dist/*.whl)" | |
>> "$GITHUB_OUTPUT" | |
- name: Publish GitHub Release | |
# Publish a GitHub release with the built .whl | |
# using the version tag from pyproject.toml | |
uses: ncipollo/release-action@v1 | |
env: | |
PYTHON_PKG_VERSION: ${{ steps.python-package-version.outputs.PYTHON_PKG_VERSION }} | |
PYTHON_PKG_PATH: ${{ steps.python-package-path.outputs.PYTHON_PKG_PATH }} | |
with: | |
tag: ${{ env.PYTHON_PKG_VERSION }} | |
artifacts: ${{ env.PYTHON_PKG_PATH }} | |
artifactErrorsFailBuild: true | |
generateReleaseNotes: true | |
makeLatest: true |