From d11a9c33a5510333e1bc8caf0edda0411b5f08e4 Mon Sep 17 00:00:00 2001 From: Fabrice Brito Date: Fri, 13 Dec 2024 11:40:14 +0100 Subject: [PATCH] Update package.yaml --- .github/workflows/package.yaml | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 5d1839b..816b5eb 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -27,17 +27,33 @@ jobs: run: | # python -m pip install --upgrade pip pip install hatch - - name: Build package run: hatch build - - name: Test package run: hatch -e test run nose2 --verbose - - name: Publish package distributions to Test PyPI - env: - HATCH_INDEX_USER: __token__ # Use '__token__' as the username - HATCH_INDEX_AUTH: ${{ secrets.PYPI_APIKEY }} # PyPI API token stored as a secret + if: github.ref != 'refs/heads/master' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true + repository-url: https://test.pypi.org/legacy/ + - name: Publish package distributions to PyPI + if: github.ref == 'refs/heads/master' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true + repository-url: https://upload.pypi.org/legacy/ + container-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: echo version ${{needs.version.outputs.app-version}} + - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: build & push image run: | - hatch build - hatch publish + version=$( cat calrissian/__about__.py | cut -d "=" -f 2 | tr -d '"' ) + IMAGE_ID=ghcr.io/duke-gcb/calrissian/calrissian + docker build . --file Dockerfile --tag calrissian + docker tag calrissian $IMAGE_ID:$version + docker push $IMAGE_ID:$version +