Publish Python package #34
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 Python package | |
on: | |
schedule: | |
- cron: 0 0 * * 1 | |
workflow_dispatch: | |
jobs: | |
version: | |
outputs: | |
types: ${{ steps.version.outputs.types }} | |
tag: ${{ steps.tag.outputs.tag }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get version | |
id: version | |
run: | | |
echo "TYPES=$(npm view valorant-api-types --json | jq -r .version)" >> $GITHUB_OUTPUT | |
- name: Get Previous tag | |
id: tag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
fallback: "0.7.0" | |
build: | |
needs: version | |
if: needs.version.outputs.types != needs.version.outputs.tag | |
uses: ./.github/workflows/deno.yml | |
publish: | |
needs: [version, build] | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./template | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Download generated python module | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-module | |
path: template/ValWrap/ | |
- name: Setup python project version | |
run: | | |
sed -i "s/^\(version = \).*$/\1\"$next\"/" pyproject.toml | |
env: | |
next: ${{ needs.version.outputs.types }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TOKEN }} | |
packages-dir: template/dist/ | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.version.outputs.types }} |