-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7957943
commit 34689a0
Showing
1 changed file
with
5 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
name: Update Version, Test, Publish to PyPI, and Upload Release Artifacts | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build-test-publish-upload: | ||
runs-on: ubuntu-latest | ||
|
@@ -40,22 +38,19 @@ jobs: | |
# retrieve the ambient OIDC token | ||
resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ | ||
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi") | ||
oidc_token=$(jq -r '.value' <<< "${resp}") | ||
oidctoken=$(jq -r '.value' <<< "${resp}") | ||
# exchange the OIDC token for an API token | ||
resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") | ||
resp=$(curl -X POST https://pypi.org//oidc/mint-token -d "{\"token\": \"${oidc_token}\"}") | ||
api_token=$(jq -r '.token' <<< "${resp}") | ||
# mask the newly minted API token, so that we don't accidentally leak it | ||
echo "::add-mask::${api_token}" | ||
# see the next step in the workflow for an example of using this step output | ||
echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}" | ||
- name: Publish to PyPI | ||
env: | ||
PYPI_API_TOKEN: ${{ steps.mint-token.outputs.api-token }} | ||
run: | | ||
hatch publish -u __token__ -a $PYPI_API_TOKEN | ||
hatch publish -u token -a $PYPI_API_TOKEN | ||
- name: Upload Release Asset | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
|
@@ -71,18 +66,15 @@ jobs: | |
PACKAGE_NAME="mesa_frames" | ||
CURRENT_VERSION=$(hatch version) | ||
pip install $PACKAGE_NAME==$CURRENT_VERSION | ||
python -c "import mesa_frames; print(mesa_frames.__version__)" | ||
python -c "import mesa_frames; print(mesa_frames.version)" | ||
# Bump to next development version | ||
hatch version patch | ||
hatch version dev | ||
# Get the new version | ||
NEW_VERSION=$(hatch version) | ||
# Commit and push the version bump | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add mesa-frames/__init__.py | ||
git add mesa-frames/init.py | ||
git commit -m "Bump version to $NEW_VERSION [skip ci]" | ||
git push |