|
| 1 | +# This pipeline is designed to create a wheel and publich the wheel on |
| 2 | +# GitHub |
| 3 | + |
| 4 | +# Execute pipeline only on a new tag, if the tag |
| 5 | +# if named "v*" (e.g. v1.0) |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + |
| 11 | + |
| 12 | +# Pipeline name |
| 13 | +name: Create new release |
| 14 | + |
| 15 | + |
| 16 | +# Run pipeline |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + name: Build package |
| 20 | + uses: ./.github/workflows/python-app.yml |
| 21 | + deploy: |
| 22 | + name: Deploy package |
| 23 | + runs-on: ubuntu-latest |
| 24 | + needs: [build] |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@v2 |
| 28 | + - name: Set up Python 3.9 |
| 29 | + uses: actions/setup-python@v2 |
| 30 | + with: |
| 31 | + python-version: 3.9 |
| 32 | + - name: Install dependencies |
| 33 | + run: | |
| 34 | + python -m pip install --upgrade pip |
| 35 | + python3 -m pip install build |
| 36 | + - name: Compute release version |
| 37 | + run: | |
| 38 | + TAG=${{ github.ref }} |
| 39 | + echo "VERSION=${TAG#refs/tags/v}" >> $GITHUB_ENV |
| 40 | + echo "The release version if ${TAG#refs/tags/v}" |
| 41 | + - name: Create wheel |
| 42 | + env: |
| 43 | + TAG_NAME: ${{ env.VERSION }} |
| 44 | + run: python -m build |
| 45 | + - name: Create release |
| 46 | + id: create_release |
| 47 | + uses: actions/create-release@v1 |
| 48 | + env: |
| 49 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + with: |
| 51 | + tag_name: ${{ env.VERSION }} |
| 52 | + draft: false |
| 53 | + prerelease: false |
| 54 | + - name: Upload release assets |
| 55 | + uses: actions/upload-release-asset@v1 |
| 56 | + env: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + with: |
| 59 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 60 | + asset_path: ./dist/mylib-${{ env.VERSION }}-py3-none-any.whl |
| 61 | + asset_name: mylib-${{ env.VERSION }}-py3-none-any.whl |
| 62 | + asset_content_type: application/x-wheel+zip |
0 commit comments