Skip to content

Commit

Permalink
Update workflow as per rpanderson/workflow-sandbox#38
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjbillington committed Apr 7, 2023
1 parent 5df0dba commit 786f93e
Showing 1 changed file with 50 additions and 67 deletions.
117 changes: 50 additions & 67 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ on:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

defaults:
run:
shell: bash -l {0}

env:
PACKAGE_NAME: zprocess
SCM_LOCAL_SCHEME: no-local-version
Expand Down Expand Up @@ -41,30 +37,30 @@ jobs:
strategy:
matrix:
include:
- { os: ubuntu-latest, python: 3.9, arch: x64 }
- { os: ubuntu-latest, python: 3.8, arch: x64 }
- { os: ubuntu-latest, python: 3.7, arch: x64 }
- { os: ubuntu-latest, python: 3.6, arch: x64 }

- { os: macos-latest, python: 3.9, arch: x64 }
- { os: macos-latest, python: 3.8, arch: x64 }
- { os: macos-latest, python: 3.7, arch: x64 }
- { os: macos-latest, python: 3.6, arch: x64 }

- { os: windows-latest, python: 3.9, arch: x64 }
- { os: windows-latest, python: 3.8, arch: x64 }
- { os: windows-latest, python: 3.7, arch: x64 }
- { os: windows-latest, python: 3.6, arch: x64 }

- { os: windows-latest, python: 3.9, arch: x86 }
- { os: windows-latest, python: 3.8, arch: x86 }
- { os: windows-latest, python: 3.7, arch: x86 }
- { os: windows-latest, python: 3.6, arch: x86 }

if: github.repository == 'chrisjbillington/zprocess' && (github.event_name != 'create' || github.event.ref_type != 'branch')
- { os: ubuntu-latest, python: '3.10', arch: x64 }
- { os: ubuntu-latest, python: '3.9', arch: x64 }
- { os: ubuntu-latest, python: '3.8', arch: x64 }
- { os: ubuntu-latest, python: '3.7', arch: x64 }

- { os: macos-latest, python: '3.10', arch: x64 }
- { os: macos-latest, python: '3.9', arch: x64 }
- { os: macos-latest, python: '3.8', arch: x64 }
- { os: macos-latest, python: '3.7', arch: x64 }

- { os: windows-latest, python: '3.10', arch: x64 }
- { os: windows-latest, python: '3.9', arch: x64 }
- { os: windows-latest, python: '3.8', arch: x64 }
- { os: windows-latest, python: '3.7', arch: x64 }

- { os: windows-latest, python: '3.10', arch: x86 }
- { os: windows-latest, python: '3.9', arch: x86 }
- { os: windows-latest, python: '3.8', arch: x86 }
- { os: windows-latest, python: '3.7', arch: x86 }

if: github.repository == 'rpanderson/workflow-sandbox' && (github.event_name != 'create' || github.event.ref_type != 'branch')
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -73,7 +69,7 @@ jobs:
run: git tag -d $(git tag --points-at HEAD)

- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}
Expand All @@ -93,12 +89,13 @@ jobs:
- name: Upload Artifact
if: strategy.job-index == 0 || (env.PURE == 'false' && runner.os != 'Linux')
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: ./dist

- name: Set Variables for Conda Build
shell: bash
run: |
if [ $NOARCH == true ]; then
CONDA_BUILD_ARGS="--noarch"
Expand All @@ -108,10 +105,7 @@ jobs:
echo "CONDA_BUILD_ARGS=$CONDA_BUILD_ARGS" >> $GITHUB_ENV
- name: Install Miniconda
# We need https://github.com/conda-incubator/setup-miniconda/pull/189 in order
# to be able to install 32-bit miniconda on Windows. Once setup-miniconda 2.1.2
# is released with this fix, can change to @v2.
uses: conda-incubator/setup-miniconda@1a875d105ac03256664b54c882c8c374ce617ef6
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}
Expand All @@ -123,9 +117,10 @@ jobs:
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 11.7

- name: Conda package (Unix)
if: runner.os != 'Windows'
shell: bash -l {0}
run: |
conda install -c labscript-suite setuptools-conda
setuptools-conda build $CONDA_BUILD_ARGS .
Expand All @@ -138,7 +133,7 @@ jobs:
setuptools-conda build %CONDA_BUILD_ARGS% --croot ${{ runner.temp }}\cb .
- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: conda_packages
path: ./conda_packages
Expand All @@ -147,16 +142,11 @@ jobs:
manylinux:
name: Build Manylinux
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { python: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39' }

if: github.repository == 'chrisjbillington/zprocess' && (github.event_name != 'create' || github.event.ref_type != 'branch')
steps:
- name: Checkout
if: env.PURE == 'false'
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -166,16 +156,17 @@ jobs:

- name: Build Manylinux Wheels
if: env.PURE == 'false'
uses: RalfG/python-wheels-manylinux-build@v0.4.0
uses: RalfG/python-wheels-manylinux-build@v0.4.2
with:
python-versions: ${{ matrix.python }}
python-versions: 'cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
pre-build-command: 'git config --global --add safe.directory "*"'

- name: Upload Artifact
if: env.PURE == 'false'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dist
path: wheelhouse/*manylinux*.whl
path: dist/*manylinux*.whl

release:
name: Release
Expand All @@ -184,56 +175,45 @@ jobs:
steps:

- name: Download Artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: dist
path: ./dist

- name: Download Artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: conda_packages
path: ./conda_packages

- name: Publish on TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.testpypi }}
repository_url: https://test.pypi.org/legacy/

- name: Get Version Number
if: github.event.ref_type == 'tag'
run: |
VERSION="${GITHUB_REF/refs\/tags\/v/}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create GitHub Release
- name: Create GitHub Release and Upload Release Asset
if: github.event.ref_type == 'tag'
id: create_release
uses: actions/create-release@latest
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.ref }}
release_name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
draft: true
prerelease: ${{ contains(github.event.ref, 'rc') }}
files: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz

- name: Upload Release Asset
if: github.event.ref_type == 'tag'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish on TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
asset_name: ${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
asset_content_type: application/gzip
user: __token__
password: ${{ secrets.testpypi }}
repository-url: https://test.pypi.org/legacy/

- name: Publish on PyPI
if: github.event.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi }}
Expand All @@ -244,10 +224,12 @@ jobs:
auto-update-conda: true

- name: Install Anaconda cloud client
shell: bash -l {0}
run: conda install anaconda-client

- name: Publish to Anaconda test label
if: github.event.ref_type != 'tag'
shell: bash -l {0}
run: |
anaconda \
--token ${{ secrets.ANACONDA_API_TOKEN }} \
Expand All @@ -257,6 +239,7 @@ jobs:
conda_packages/*/*
- name: Publish to Anaconda main label
shell: bash -l {0}
if: github.event.ref_type == 'tag'
run: |
anaconda \
Expand Down

0 comments on commit 786f93e

Please sign in to comment.