Skip to content

Merge pull request #187 from AllenNeuralDynamics/release-v0.19.0 #12

Merge pull request #187 from AllenNeuralDynamics/release-v0.19.0

Merge pull request #187 from AllenNeuralDynamics/release-v0.19.0 #12

Workflow file for this run

name: Tag and publish main
on:
push:
branches:
- main
jobs:
tag_and_publish:
name: Parse version
runs-on: ubuntu-latest
outputs:
pkg_version: ${{ steps.output_version.outputs.pkg_version }}
steps:
- uses: actions/checkout@v3
- name: Get version from file
run: |
pkg_name=$(grep -P 'version = \{attr = .*\}' pyproject.toml | grep -oP '\w+.__version__')
init_file="./src/${pkg_name//.__version__}/__init__.py"
pkg_version=$(grep -Po '[0-9]+\.[0-9]+\.[0-9]+' "$init_file")
echo "tag=$pkg_version" >> "$GITHUB_ENV"
- name: Create git tag
run: |
git tag "v${{ env.tag }}"
- name: Push git tag
run: git push origin "v${{ env.tag }}"
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install --upgrade setuptools wheel twine build
python -m build
twine check dist/*
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.AIND_PYPI_TOKEN }}
publish_container:
runs-on: ubuntu-latest
env:
GO_VERSION: '1.14.12'
GO_OS: 'linux'
GO_ARCH: 'amd64'
SINGULARITY_VERSION: '3.7.0'
steps:
- uses: actions/checkout@v3
- name: Get version from file
run: |
pkg_name=$(grep -P 'version = \{attr = .*\}' pyproject.toml | grep -oP '\w+.__version__')
init_file="./src/${pkg_name//.__version__}/__init__.py"
pkg_version=$(grep -Po '[0-9]+\.[0-9]+\.[0-9]+' "$init_file")
echo "tag=$pkg_version" >> "$GITHUB_ENV"
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
libseccomp-dev \
wget \
pkg-config \
procps
- name: Install GO
run: |
wget https://dl.google.com/go/go$GO_VERSION.$GO_OS-$GO_ARCH.tar.gz
sudo tar -C /usr/local -xzvf go$GO_VERSION.$GO_OS-$GO_ARCH.tar.gz
sudo rm go$GO_VERSION.$GO_OS-$GO_ARCH.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/profile
- name: Install Singularity
run: |
cd ..
wget https://github.com/hpcng/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-${SINGULARITY_VERSION}.tar.gz
sudo tar -xzf singularity-${SINGULARITY_VERSION}.tar.gz
sudo rm singularity-${SINGULARITY_VERSION}.tar.gz
echo "Finished installing binaries"
export PATH=$PATH:/usr/local/go/bin
cd singularity
sudo ./mconfig --without-suid
sudo make -C ./builddir
sudo make -C ./builddir install
- name: Build sif container
run: |
ls /
ls
mkdir build
sudo singularity build build/container.sif scripts/singularity_build.def
- name: Login and Deploy Container
run: |
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
singularity push build/container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${{ env.tag }}
singularity push build/container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:latest