Skip to content

Make single-file installers #64

Make single-file installers

Make single-file installers #64

Workflow file for this run

name: Make single-file installers
on:
workflow_dispatch:
defaults:
run:
shell: bash -leo pipefail {0}
jobs:
test:
name: Building single file installer on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-12, ubuntu-latest]
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Latest Version
id: latest-version
run: |
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
# slice off the v, ie v0.7.2 -> 0.7.2
VERSION=${LATEST_TAG:1}
echo $VERSION
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Print Latest Version
run: echo ${{ steps.latest-version.outputs.VERSION }}
- name: Install constructor environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: installer
create-args: >-
python=3.10
jinja2
constructor
init-shell: bash
- name: Create installer
run: VERSION=${{ steps.latest-version.outputs.VERSION }} constructor devtools/installer/
- name: Get installer file name
id: file-name
run: |
# This should work as long as we don't have any *.sh files in our root dir
FILE_NAME=$(find * -maxdepth 0 -type f -name "*.sh")
echo $FILE_NAME
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_OUTPUT
- name: Test installer
run: |
chmod +x ${{ steps.file-name.outputs.FILE_NAME }}
./${{ steps.file-name.outputs.FILE_NAME }} -b
export PATH="$HOME/openfeforge/bin:$PATH"
OFE_SLOW_TESTS=FALSE pytest -v --pyargs openfe
# Copy for "latest" release by removing version
# Inspired by https://github.com/conda-forge/miniforge/blob/main/.github/workflows/ci.yml
cp ${{ steps.file-name.outputs.FILE_NAME }} $(echo ${{ steps.file-name.outputs.FILE_NAME }} | sed -e 's/-[^-]*//')
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.file-name.outputs.FILE_NAME }}
path: OpenFEforge*
if-no-files-found: error
- name: Upload openfe forge to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: OpenFEforge*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
if: startsWith(github.ref, 'refs/tags/')