Skip to content

Commit

Permalink
updating the GH Action
Browse files Browse the repository at this point in the history
  • Loading branch information
adamamer20 committed Aug 25, 2024
1 parent 7957943 commit 34689a0
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/publish.yml
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
Expand Down Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 34689a0

Please sign in to comment.