From 94aa94ff7b999894722ecb0a6095aecb4b2fae8f Mon Sep 17 00:00:00 2001 From: Camden Narzt Date: Sat, 13 Jan 2024 19:48:51 -0700 Subject: [PATCH] try to automate releases --- .github/workflows/python-package.yml | 59 ++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 11cd2ae..6a14eed 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -58,26 +58,59 @@ jobs: - name: Types Test run: pyright --verifytypes getargv working-directory: getargv.py - - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.os }}.zip - path: | - getargv.py/dist/*.whl - getargv.py/dist/*.tar.gz release: - if: ${{ github.ref_type == 'tag' }} needs: [ build ] - runs-on: ubuntu-latest + runs-on: macos-latest + permissions: + contents: write steps: - - uses: actions/download-artifact@v3 + - uses: actions/checkout@v4 + with: + repository: getargv/getargv + path: getargv + token: ${{ secrets.GH_PAT }} + - name: Build libgetargv + run: make install_dylib + working-directory: getargv + - uses: actions/checkout@v4 + with: + path: getargv.py + - name: Set up Python 3 + uses: actions/setup-python@v4 + with: + python-version: 3.x + check-latest: true + - name: Upgrade pip & Install deps + run: | + python3 -m pip install --upgrade pip + python3 -m pip install build pyright + - name: Bump version + id: bump_version + run: | + make bump_version + echo "new_version=$(make version)" >> $GITHUB_OUTPUT + - name: Build & install + run: | + python3 -m build + python3 -m pip install dist/getargv-*.tar.gz + working-directory: getargv.py + - uses: actions/upload-artifact@v3 with: - path: dist + name: dist.zip + path: getargv.py/dist + - name: create && push tag + run: | + git commit -am 'release ${{ steps.bump_version.outputs.new_version }}' + git tag '${{ steps.bump_version.outputs.new_version }}' + git push origin tag '${{ steps.bump_version.outputs.new_version }}' + git push origin HEAD:main + working-directory: getargv.py - name: Release uses: softprops/action-gh-release@v1 with: - files: dist/*.zip/* - name: ${{ github.ref_name }} + files: getargv.py/dist/* + name: ${{ steps.bump_version.outputs.new_version }} pypi-publish: # hopefully this dep is enough to only run on release @@ -91,5 +124,5 @@ jobs: id-token: write steps: - uses: actions/download-artifact@v3 - - run: mv *.zip/dist ./ + - run: mv dist.zip/dist ./ - uses: pypa/gh-action-pypi-publish@release/v1