From 126393ce7b255a697d4decd6a93382f4306f82e9 Mon Sep 17 00:00:00 2001 From: F-G Fernandez <26927750+frgfm@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:36:46 +0200 Subject: [PATCH] ci: Fixes publish job --- .../workflows/{release.yml => publish.yml} | 42 +++++++------------ 1 file changed, 16 insertions(+), 26 deletions(-) rename .github/workflows/{release.yml => publish.yml} (68%) diff --git a/.github/workflows/release.yml b/.github/workflows/publish.yml similarity index 68% rename from .github/workflows/release.yml rename to .github/workflows/publish.yml index dd799de..2df19ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/publish.yml @@ -1,17 +1,16 @@ -name: release +name: publish on: release: types: [published] jobs: - pypi-publish: + pypi: if: "!github.event.release.prerelease" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v4 + - uses: actions/setup-python@v4 with: python-version: 3.9 architecture: x64 @@ -24,24 +23,20 @@ jobs: run: | python -m pip install --upgrade pip pip install setuptools wheel twine --upgrade - - name: Get release tag - id: release_tag - run: | - echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - VERSION: ${{ steps.release_tag.outputs.VERSION }} run: | - BUILD_VERSION=${VERSION:1} python setup.py sdist bdist_wheel + echo "BUILD_VERSION=${GITHUB_REF#refs/*/}" | cut -c 2- >> $GITHUB_ENV + python setup.py sdist bdist_wheel twine check dist/* twine upload dist/* pypi-check: if: "!github.event.release.prerelease" runs-on: ubuntu-latest - needs: pypi-publish + needs: pypi steps: - uses: actions/checkout@v2 - name: Set up Python @@ -55,7 +50,7 @@ jobs: pip install torchcam python -c "import torchcam; print(torchcam.__version__)" - conda-publish: + conda: if: "!github.event.release.prerelease" runs-on: ubuntu-latest steps: @@ -65,37 +60,32 @@ jobs: with: auto-update-conda: true python-version: 3.9 - auto-activate-base: true - name: Install dependencies - run: | - conda install -y conda-build conda-verify anaconda-client - - name: Get release tag - id: release_tag - run: | - echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + shell: bash -el {0} + run: conda install -y conda-build conda-verify anaconda-client - name: Build and publish + shell: bash -el {0} env: ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} - VERSION: ${{ steps.release_tag.outputs.VERSION }} run: | - BUILD_VERSION=${VERSION:1} python setup.py sdist + echo "BUILD_VERSION=${GITHUB_REF#refs/*/}" | cut -c 2- >> $GITHUB_ENV + python setup.py sdist mkdir conda-dist - conda-build .conda/ -c pytorch --output-folder conda-dist + conda build .conda/ -c pytorch --output-folder conda-dist ls -l conda-dist/noarch/*tar.bz2 anaconda upload conda-dist/noarch/*tar.bz2 conda-check: if: "!github.event.release.prerelease" runs-on: ubuntu-latest - needs: conda-publish + needs: conda steps: - - name: Miniconda setup - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v2 with: auto-update-conda: true python-version: 3.9 - auto-activate-base: true - name: Install package + shell: bash -el {0} run: | conda install -c frgfm torchcam python -c "import torchcam; print(torchcam.__version__)"