Publish Package #5
This file contains hidden or 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
| name: Publish Package | |
| on: workflow_dispatch | |
| concurrency: | |
| group: "${{ github.ref }}" | |
| cancel-in-progress: true | |
| env: | |
| PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}" | |
| jobs: | |
| tag-release: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| permissions: write-all | |
| env: | |
| GIT_STRATEGY: clone | |
| IMAGE_NAME: "${NDIP_DOCKER_REPOSITORY}/${{ github.repository }}" | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 20 | |
| lfs: true | |
| - name: Parse version | |
| run: echo "VERSION=$(cat pyproject.toml | grep "version =" | head -n 1 | awk '{ print $3 }' | tr -d '"')" >> $GITHUB_ENV | |
| - name: Create release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ env.VERSION }} | |
| release_name: ${{ env.VERSION }} | |
| publish-package: | |
| needs: tag-release | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' | |
| timeout-minutes: 60 | |
| env: | |
| GIT_STRATEGY: clone | |
| IMAGE_NAME: "${NDIP_DOCKER_REPOSITORY}/${{ github.repository }}" | |
| steps: | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 20 | |
| lfs: true | |
| - name: Build | |
| uses: docker/build-push-action@v6 | |
| id: build | |
| with: | |
| file: dockerfiles/Dockerfile | |
| load: true | |
| - name: Publish | |
| run: docker run --rm ${{ steps.build.outputs.imageid }} sh -c "hatch build && hatch publish -u __token__ -a ${PYPI_API_TOKEN}" |