Binary Release (single) #26
Workflow file for this run
This file contains hidden or 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: Binary Release (single) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| mlton-version: | |
| required: true | |
| type: string | |
| runner: | |
| required: true | |
| type: string | |
| msystem: | |
| required: false | |
| type: string | |
| old-mlton-runtime-args: | |
| required: false | |
| type: string | |
| old-mlton-compile-args: | |
| required: false | |
| type: string | |
| mlton-runtime-args: | |
| required: false | |
| type: string | |
| mlton-compile-args: | |
| required: false | |
| type: string | |
| mlton-binary-release: | |
| required: false | |
| type: string | |
| mlton-binary-release-suffix-xtra: | |
| required: false | |
| type: string | |
| workflow_call: | |
| inputs: | |
| mlton-version: | |
| required: true | |
| type: string | |
| runner: | |
| required: true | |
| type: string | |
| msystem: | |
| required: false | |
| type: string | |
| old-mlton-runtime-args: | |
| required: false | |
| type: string | |
| old-mlton-compile-args: | |
| required: false | |
| type: string | |
| mlton-runtime-args: | |
| required: false | |
| type: string | |
| mlton-compile-args: | |
| required: false | |
| type: string | |
| mlton-binary-release: | |
| required: false | |
| type: string | |
| mlton-binary-release-suffix-xtra: | |
| required: false | |
| type: string | |
| jobs: | |
| binary-release-single: | |
| runs-on: ${{ inputs.runner }} | |
| defaults: | |
| run: | |
| shell: ${{ (startsWith(inputs.runner, 'windows') && 'msys2 {0}') || 'bash' }} | |
| env: | |
| MLTON_VERSION: ${{ inputs.mlton-version }} | |
| MLTON_BINARY_RELEASE: ${{ inputs.mlton-binary-release || '1' }} | |
| steps: | |
| - name: Configure git | |
| run: git config --global core.autocrlf false | |
| shell: bash | |
| - name: Install msys2 (windows) | |
| if: ${{ runner.os == 'Windows' }} | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: ${{ inputs.msystem }} | |
| update: false | |
| install: >- | |
| base-devel | |
| git | |
| pactoys | |
| pacboy: >- | |
| github-cli:p | |
| - name: Download and unpack source release | |
| run: | | |
| curl --fail -s -O -L https://github.com/${{ github.repository }}/releases/download/on-${{ inputs.mlton-version }}-release/mlton-${{ inputs.mlton-version }}.src.tgz | |
| tar xzf mlton-${{ inputs.mlton-version }}.src.tgz --strip-components=1 || \ | |
| tar xzf mlton-${{ inputs.mlton-version }}.src.tgz --strip-components=1 | |
| rm mlton-${{ inputs.mlton-version }}.src.tgz | |
| - name: Evaluate environment variables | |
| shell: bash | |
| run: | | |
| export MLTON_HOST_ARCH=$(./bin/host-arch) | |
| echo "MLTON_HOST_ARCH=$MLTON_HOST_ARCH" >> $GITHUB_ENV | |
| export MLTON_TARGET_ARCH=${MLTON_HOST_ARCH} | |
| echo "MLTON_TARGET_ARCH=$MLTON_TARGET_ARCH" >> $GITHUB_ENV | |
| export MLTON_HOST_OS=$(./bin/host-os) | |
| echo "MLTON_HOST_OS=$MLTON_HOST_OS" >> $GITHUB_ENV | |
| export MLTON_TARGET_OS=${MLTON_HOST_OS} | |
| echo "MLTON_TARGET_OS=$MLTON_TARGET_OS" >> $GITHUB_ENV | |
| export MLTON_BINARY_RELEASE_SUFFIX=.${{ inputs.runner }}${{ inputs.msystem && format('_msys2_{0}', inputs.msystem) || '' }}${{ inputs.mlton-binary-release-suffix-xtra && format('_{0}', inputs.mlton-binary-release-suffix-xtra) || '' }} | |
| echo "MLTON_BINARY_RELEASE_SUFFIX=$MLTON_BINARY_RELEASE_SUFFIX" >> $GITHUB_ENV | |
| export MLTON_BINARY_RLEASE_NAME=mlton-${MLTON_VERSION}-${MLTON_BINARY_RELEASE}.${MLTON_TARGET_ARCH}-${MLTON_TARGET_OS}${MLTON_BINARY_RELEASE_SUFFIX} | |
| echo "MLTON_BINARY_RELEASE_NAME=${MLTON_BINARY_RELEASE_NAME}" >> $GITHUB_ENV | |
| - name: Check if artifact exists | |
| id: artifact_exists | |
| run: echo artifact_exists=$(gh release view --json assets -q '[.assets[] | .name | ascii_downcase | . == ("${{env.MLTON_BINARY_RLEASE_NAME }}.tgz" | ascii_downcase)] | any' -R MLton/mlton) >> $GITHUB_OUTPUT | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout | |
| if: ${{ steps.artifact_exists.output.artifact_exists != 'true' }} | |
| uses: actions/checkout@v6 | |
| with: | |
| sparse-checkout: .github | |
| - name: Install bootstrap dependencies | |
| if: ${{ steps.artifact_exists.output.artifact_exists != 'true' }} | |
| uses: ./.github/actions/install-bootstrap-dependencies | |
| with: | |
| install-llvm: false | |
| - name: Make binary release | |
| if: ${{ steps.artifact_exists.output.artifact_exists != 'true' }} | |
| run: | | |
| # make binary-release | |
| PATH=$(pwd)/boot/bin:$PATH \ | |
| make \ | |
| OLD_MLTON_RUNTIME_ARGS="ram-slop 0.90 ${{ inputs.old-mlton-runtime-args }}" \ | |
| OLD_MLTON_COMPILE_ARGS="${{ inputs.old-mlton-compile-args }}" \ | |
| MLTON_RUNTIME_ARGS="ram-slop 0.90 ${{ inputs.mlton-runtime-args }}" \ | |
| MLTON_COMPILE_ARGS="${{ inputs.mlton-compile-args }}" \ | |
| ${{ env.WITH_GMP_DIR && format('WITH_GMP_DIR={0}', env.WITH_GMP_DIR) || '' }} \ | |
| MLTON_VERSION="${{ env.MLTON_VERSION }}" \ | |
| MLTON_BINARY_RELEASE="${{ env.MLTON_BINARY_RELEASE }}" \ | |
| MLTON_BINARY_RELEASE_SUFFIX="${{ env.MLTON_BINARY_RELEASE_SUFFIX }}" \ | |
| binary-release | |
| - name: Upload binary release | |
| if: ${{ steps.artifact_exists.output.artifact_exists != 'true' }} | |
| run: gh release upload on-${{ inputs.mlton-version }}-release mlton-${{ inputs.mlton-version }}*.tgz --clobber | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |