Further CI correction to build system (#25) #25
This file contains 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: Build on merging to master | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
git-tag-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version number | |
run: | | |
VERSION="$(grep ':Version:' README.rst | awk '{print $2}')" | |
echo "DIST_VERSION=v${VERSION}" >> $GITHUB_ENV | |
- name: Create Tag | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const {DIST_VERSION} = process.env | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/tags/${DIST_VERSION}`, | |
sha: context.sha | |
}) | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: "${{ env.DIST_VERSION }}" | |
tag: "${{ env.DIST_VERSION }}" | |
generateReleaseNotes: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
pypi-release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install pypa/build | |
run: python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: python -m build --sdist --wheel --outdir dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
pypi-public: | |
needs: pypi-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version number | |
run: | | |
VERSION="$(grep ':Version:' README.rst | awk '{print $2}')" | |
echo "VERSION_NUMBER=${VERSION}" >> $GITHUB_ENV | |
- name: Wait for PyPi | |
uses: nev7n/wait_for_response@v1 | |
with: | |
url: "https://files.pythonhosted.org/packages/source/l/lsbi/lsbi-${{ env.VERSION_NUMBER }}.tar.gz" | |
responseCode: 200 | |
timeout: 600000 | |
interval: 10000 | |
aur-release: | |
needs: pypi-public | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tomli | |
- name: Generate PKGBUILD | |
run: python ./bin/gen_PKGBUILD.py > ./PKGBUILD | |
- name: Publish AUR package | |
uses: KSXGitHub/[email protected] | |
with: | |
pkgname: python-lsbi | |
pkgbuild: ./PKGBUILD | |
updpkgsums: True | |
commit_username: ${{ secrets.AUR_USERNAME }} | |
commit_email: ${{ secrets.AUR_EMAIL }} | |
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
conda-release: | |
needs: pypi-public | |
name: Build and deploy to conda | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Conda environment creation and activation | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: '3.9' | |
auto-update-conda: false | |
auto-activate-base: false | |
show-channel-urls: true | |
- name: install dependencies | |
shell: bash -el {0} | |
run: conda install grayskull conda-build anaconda-client | |
- name: Generate meta.yaml from grayskull | |
shell: bash -el {0} | |
run: grayskull pypi --strict-conda-forge lsbi | |
- name: Build and upload the conda packages | |
uses: uibcdf/[email protected] | |
with: | |
meta_yaml_dir: lsbi | |
python-version: '3.9' | |
user: handley-lab | |
label: 'main' | |
token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret |