Skip to content

Commit

Permalink
ci: Fixes publish job
Browse files Browse the repository at this point in the history
  • Loading branch information
frgfm committed Oct 19, 2023
1 parent 56e0777 commit 126393c
Showing 1 changed file with 16 additions and 26 deletions.
42 changes: 16 additions & 26 deletions .github/workflows/release.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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__)"

0 comments on commit 126393c

Please sign in to comment.