diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index efcc5ad..e21432d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -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: @@ -17,12 +19,45 @@ 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 + 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 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./source-distribution/traceon-${{ env.VERSION }}.tar.gz # Adjust the path to your wheel