Skip to content

Commit

Permalink
Automatically create Github release in publish.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-vv committed Oct 29, 2024
1 parent b58cc36 commit 1ddb60d
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
publish_wheels:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
Expand All @@ -17,12 +19,49 @@ jobs:
with:
workflow: build-and-test.yaml
branch: main
name: .*-wheel
name: (.*-wheel)|source-distribution
name_is_regexp: true
search_artifacts: true
- name: List
- name: List artifacts
run: |
ls **/*.whl
ls source-distribution/*.tar.gz
- name: Extract version information
run: |
VERSION=$(python3 ./setup.py --version)
TAG=v$VERSION
echo "Version found: $VERSION"
echo "Using tag: $TAG"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "TAG=v$VERSION" >> $GITHUB_ENV
if [[ "$VERSION" == *rc* ]]; then
echo "PRERELEASE=true" >> $GITHUB_ENV
echo "This is a prerelease."
else
echo "PRERELEASE=false" >> $GITHUB_ENV
echo "This is a full release."
fi
- name: Create Git tag
run: |
git tag $TAG
git push origin $TAG
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG }}
release_name: ${{ env.TAG }}
prerelease: ${{ env.PRERELEASE }}
draft: false
- name: Upload Release Assets
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./source-distribution/traceon-${{ env.VERSION }}.tar.gz # Adjust the path to your wheel


0 comments on commit 1ddb60d

Please sign in to comment.