Skip to content

Build and release all bins #69

Build and release all bins

Build and release all bins #69

Workflow file for this run

name: Build and release all bins
on:
push:
# only build when we have a tag starting with v (e.g. v0.0.1)
tags: 'v*'
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install deps
run: |
install_conda() {
local platform=$(uname)
if [[ "$platform" == "Darwin" ]]; then
platform="MacOSX"
fi
local miniforge_url="https://github.com/conda-forge/miniforge/releases/download/4.10.0-0/Miniforge3-4.10.0-0-$platform-$arch.sh"
local conda_url="https://repo.continuum.io/miniconda/Miniconda3-latest-$platform-$arch.sh"
local url="$miniforge_url"
if ! which conda; then
echo "Installing conda from URL: '$url':"
local miniconda="$(mktemp)"
curl -L "$url" >"$miniconda"
bash "$miniconda" -b -p $HOME/miniconda3
rm "$miniconda"
fi
if ! [[ -f ~/.condarc ]]; then
echo ">>> Writing $HOME/.condarc"
cat >$HOME/.condarc <<EOF
always_yes: true
channels:
- conda-forge
- defaults
EOF
fi
# ensure conda is on path for the rest of this script
export PATH=$HOME/miniconda3/bin:$HOME/miniconda2/bin:$PATH
}
install_conda
conda install conda-pack
conda install conda-build
install-warp-packer() {
local platform=$(uname)
local warp_dl_url
if [[ "$platform" == "Darwin" ]]; then
platform="macos"
elif [[ "$platform" == "Linux" ]]; then
platform="linux"
fi
local warp_dl_url="https://github.com/nikvdp/warp/releases/download/v0.4.6/$platform-x64.warp-packer"
mkdir -p ~/bin
wget "$warp_dl_url" -O ~/bin/warp-packer
chmod +x ~/bin/warp-packer
export PATH="$HOME/bin:$PATH"
}
install-warp-packer
# make sure the PATH stays set for subsequent jobs using an env file. see: [1]
# [1]: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
echo "PATH=$PATH" >> $GITHUB_ENV
- name: build 1bins
run: |
set -x
cd "$GITHUB_WORKSPACE"
./build-all.sh
# here we are setting the FILES_TO_RELEASE env var to contain a glob
# for all files under the out/ dir (where build-all.sh drops the
# 1bins). GITHUB_ENV is a special github actions env var, see [1]
#
# [1]: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
echo "FILES_TO_RELEASE=$GITHUB_WORKSPACE/out/*" >> $GITHUB_ENV
- uses: softprops/action-gh-release@v1
with:
# the FILES_TO_RELEASE env var gets set via the GITHUB_ENV echo command in the previous step
files: ${{ env.FILES_TO_RELEASE }}
build-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: install deps
run: |
install_conda() {
local platform=$(uname)
if [[ "$platform" == "Darwin" ]]; then
platform="MacOSX"
fi
local miniforge_url="https://github.com/conda-forge/miniforge/releases/download/4.10.0-0/Miniforge3-4.10.0-0-$platform-$arch.sh"
local conda_url="https://repo.continuum.io/miniconda/Miniconda3-latest-$platform-$arch.sh"
local url="$miniforge_url"
if ! which conda; then
echo "Installing conda from URL: '$url':"
local miniconda="$(mktemp)"
curl -L "$url" >"$miniconda"
bash "$miniconda" -b -p $HOME/miniconda3
rm "$miniconda"
fi
if ! [[ -f ~/.condarc ]]; then
echo ">>> Writing $HOME/.condarc"
cat >$HOME/.condarc <<EOF
always_yes: true
channels:
- conda-forge
- defaults
EOF
fi
# ensure conda is on path for the rest of this script
export PATH=$HOME/miniconda3/bin:$HOME/miniconda2/bin:$PATH
}
install_conda
conda install conda-pack
conda install conda-build
install-warp-packer() {
local platform=$(uname)
local warp_dl_url
if [[ "$platform" == "Darwin" ]]; then
platform="macos"
elif [[ "$platform" == "Linux" ]]; then
platform="linux"
fi
local warp_dl_url="https://github.com/nikvdp/warp/releases/download/v0.4.6/$platform-x64.warp-packer"
mkdir -p ~/bin
wget "$warp_dl_url" -O ~/bin/warp-packer
chmod +x ~/bin/warp-packer
export PATH="$HOME/bin:$PATH"
}
install-warp-packer
# make sure the PATH stays set for subsequent jobs using an env file. see: [1]
# [1]: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
echo "PATH=$PATH" >> $GITHUB_ENV
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: build 1bins
run: |
set -x
# build-all.sh uses bash associative arrays, but macOS comes with an
# ancient bash that doesn't support them
export HOMEBREW_NO_INSTALL_CLEANUP=true
brew install bash
cd "$GITHUB_WORKSPACE"
/usr/local/bin/bash build-all.sh
# prefix the mac bins with 'mac-'
ls
pwd
cd "$GITHUB_WORKSPACE/out"
for i in *; do mv "$i" "mac-$i"; done
cd "$GITHUB_WORKSPACE"
# here we are setting the FILES_TO_RELEASE env var to contain a glob
# for all files under the out/ dir (where build-all.sh drops the
# 1bins). GITHUB_ENV is a special github actions env var, see [1]
#
# [1]: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
echo "FILES_TO_RELEASE=$GITHUB_WORKSPACE/out/*" >> $GITHUB_ENV
- uses: softprops/action-gh-release@v1
with:
# the FILES_TO_RELEASE env var gets set via the GITHUB_ENV echo command in the previous step
files: ${{ env.FILES_TO_RELEASE }}
trigger-deploy:
runs-on: ubuntu-latest
needs: [build-linux, build-mac]
steps:
- name: trigger 1bin.org re-deploy
run: curl -L 'https://api.vercel.com/v1/integrations/deploy/prj_lDCYBX38pUyHVmNrQriW8I2sKzLE/i27ili9oYA'