Update CHANGELOG.md #51
Workflow file for this run
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: Publish package to PyPI | |
on: | |
pull_request: | |
branches: [ "main" ] | |
types: [ "closed" ] | |
jobs: | |
test: | |
if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') }} | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.10", "3.11", "3.12" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Download episodes | |
run: | | |
wget "https://github.com/flatland-association/flatland-scenarios/raw/refs/heads/main/trajectories/FLATLAND_BENCHMARK_EPISODES_FOLDER.zip" -O FLATLAND_BENCHMARK_EPISODES_FOLDER.zip | |
mkdir -p episodes | |
unzip FLATLAND_BENCHMARK_EPISODES_FOLDER -d episodes | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Run tests | |
run: tox | |
publish: | |
runs-on: ubuntu-22.04 | |
needs: [ test ] | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox tox-gh-actions | |
- name: Build version tag | |
id: build-version-tag | |
run: | | |
VERSION=$(echo "$GITHUB_HEAD_REF" | sed 's/release\///') | |
echo "VERSION_TAG=v$VERSION" >> "$GITHUB_OUTPUT" | |
- name: Tag commit with version | |
env: | |
VERSION_TAG: ${{ steps.build-version-tag.outputs.VERSION_TAG }} | |
run: git tag "$VERSION_TAG" | |
- name: Build new package | |
run: tox run -e build | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Push version tag | |
env: | |
VERSION_TAG: ${{ steps.build-version-tag.outputs.VERSION_TAG }} | |
run: git push origin "$VERSION_TAG" | |
- name: Archive package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package | |
path: dist/ |