v2.9.1 #23
Workflow file for this run
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: Publish Release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*.*.*" | |
branches: | |
- 'release/*' | |
env: | |
# Workaround for no ternary operator, use short-circuiting | |
# I'd love to not repeat the version string, but env can't be recursive | |
VERSION: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'DEV' }} | |
MAC_PACKAGE: OpenCRAVAT.${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'DEV' }}.pkg | |
WINDOWS_INSTALLER: OpenCRAVAT-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'DEV' }}.exe | |
DOCKER_TAG: ${{ secrets.DOCKER_USERNAME }}/opencravat:${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'DEV' }} | |
DOCKER_ARCHIVE: opencravat-docker-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'DEV' }}.tgz | |
PYPI_SDIST: open-cravat-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'DEV' }}.tar.gz | |
jobs: | |
pypi: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build pypi package | |
run: echo "Building package on release" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: python setup.py sdist --formats=gztar | |
- name: Archive Image File | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PYPI_SDIST }} | |
path: ./dist/** | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
load: true | |
tags: ${{ env.DOCKER_TAG }} | |
- name: Save docker image | |
run: | | |
docker image save ${{ env.DOCKER_TAG }} | gzip > opencravat-docker-${{ env.VERSION }}.tgz | |
- name: Archive installer package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.DOCKER_ARCHIVE }} | |
path: ${{ env.DOCKER_ARCHIVE }} | |
windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install build tools | |
run: | | |
choco install innosetup | |
- name: Build and Package | |
working-directory: .build\windows | |
run: | | |
.\build.ps1 ..\.. ${{env.VERSION}} -Clean -ForceDownload -Build | |
- name: Archive installer package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.WINDOWS_INSTALLER }} | |
path: .build\windows\Output\${{ env.WINDOWS_INSTALLER }} | |
mac: | |
runs-on: macos-14 | |
env: | |
MINICONDA_DIST: Miniconda3-py311_24.1.2-0-MacOSX-x86_64 | |
PLATYPUS_RESOURCES: /Applications/Platypus.app/Contents/Resources | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install build tools | |
run: | | |
brew install --cask platypus | |
sudo mkdir -p /usr/local/share/platypus | |
gunzip ${PLATYPUS_RESOURCES}/platypus_clt.gz | |
gunzip ${PLATYPUS_RESOURCES}/ScriptExec.gz | |
chmod +x ${PLATYPUS_RESOURCES}/ScriptExec | |
sudo cp ${PLATYPUS_RESOURCES}/ScriptExec /usr/local/share/platypus/ScriptExec | |
sudo cp -r ${PLATYPUS_RESOURCES}/MainMenu.nib /usr/local/share/platypus/MainMenu.nib | |
curl -o miniconda.sh https://repo.anaconda.com/miniconda/${MINICONDA_DIST}.sh | |
chmod +x miniconda.sh | |
./miniconda.sh -b -p ./miniconda -u | |
- name: Build and Package | |
run: | | |
miniconda/bin/conda init bash | |
. ~/.bash_profile | |
conda create -y -n py3 python=3.11 pip | |
conda activate py3 | |
cd .build/mac | |
${PLATYPUS_RESOURCES}/platypus_clt -a OpenCRAVAT -u "Karchin Lab" -V $VERSION -I org.karchinlab.open-cravat -i ./AppIcon.icns -y ./script ./OpenCRAVAT.app | |
./make.sh ../.. | |
./package.sh $VERSION | |
- name: Archive installer package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.MAC_PACKAGE }} | |
path: .build/mac/${{ env.MAC_PACKAGE }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
- mac | |
- windows | |
- pypi | |
- docker | |
environment: Published | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
# Downloads all the artifacts from above, and extract them into | |
# a directory named after the artifact itself, but since the | |
# artifacts are all named after their contained package the naming | |
# looks weird. | |
# An artifact named OpenCravat-2.5.0.exe.zip will extract to a | |
# directory named OpenCravat-2.5.0.exe and contain | |
# OpenCravat-2.5.0.exe | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v4 | |
- name: Load Docker Image | |
run: | | |
docker load -i ${{ env.DOCKER_ARCHIVE }}/${{ env.DOCKER_ARCHIVE }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# this should only push since the tagged image was loaded above | |
- name: Publish Docker image | |
run: | | |
docker push ${{ env.DOCKER_TAG }} | |
- name: Publish to PyPi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: ${{ env.PYPI_SDIST }} | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Release Images | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
files: | | |
- ${{ env.MAC_PACKAGE }}/${{ env.MAC_PACKAGE }} | |
- ${{ env.WINDOWS_INSTALLER }}/${{ env.WINDOWS_INSTALLER }} |