Skip to content

release 0.5.15

release 0.5.15 #277

Workflow file for this run

name: "release"
run-name: "release ${{inputs.version}}"
defaults:
run:
shell: bash
on:
workflow_dispatch:
inputs:
version:
description: 'Release Version (E.g. M4 or M4a or 0.4.1)'
required: true
type: string
target:
description: 'Ref to use for this release, defaults to trunk'
required: true
default: 'trunk'
type: string
jobs:
release:
name: "create_release"
runs-on: ubuntu-20.04
needs:
- build_linux
- build_macos
- build_windows
steps:
- uses: actions/checkout@v2
with:
ref: release/${{inputs.version}}
- name: make download dir
run: "mkdir /tmp/ucm"
- name: "download artifacts"
uses: actions/download-artifact@v2
with:
path: /tmp/ucm
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version="${{inputs.version}}"
target="${{inputs.target}}"
# E.g. M4a -> M4, M4c -> M4b, M4 -> M3
prev_version="$(${{ github.workspace }}/scripts/previous-tag.sh "${version}")"
echo "Creating a release from these artifacts:"
ls -R /tmp/ucm
gh release create "release/${version}" --target "${target}" --generate-notes --notes-start-tag "release/${prev_version}" /tmp/ucm/**/*.tar.gz /tmp/ucm/**/*.zip
build_linux:
name: "build_linux"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: release/${{inputs.version}}
# Cache ~/.stack, keyed by the contents of 'stack.yaml'.
- uses: actions/cache@v3
name: cache ~/.stack (linux)
with:
path: ~/.stack
# Main cache key: commit hash. This should always result in a cache miss...
# So when loading a cache we'll always fall back to the restore-keys,
# which should load the most recent cache via a prefix search on the most
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-0_ubuntu-20.04-${{hashFiles('stack.yaml')}}-${{github.sha}}
# Fall-back to use the most recent cache for the stack.yaml, or failing that the OS
restore-keys: |
stack-0_ubuntu-20.04-${{hashFiles('stack.yaml')}}
stack-0_ubuntu-20.04
# Cache each local package's ~/.stack-work for fast incremental builds in CI.
- uses: actions/cache@v3
name: cache .stack-work
with:
path: |
**/.stack-work
# Main cache key: commit hash. This should always result in a cache miss...
# So when loading a cache we'll always fall back to the restore-keys,
# which should load the most recent cache via a prefix search on the most
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-work-3_ubuntu-20.04-${{github.sha}}
restore-keys: stack-work-3_ubuntu-20.04
- name: install stack (Linux)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-linux-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: build
run: |
# unison-cli embeds version numbers using TH
# so it needs to be forced to rebuild to ensure those are updated.
stack clean unison-cli
stack --no-terminal build --flag unison-parser-typechecker:optimized
- name: fetch latest Unison Local UI and package with ucm
run: |
mkdir -p /tmp/ucm/ui
UCM=$(stack path | awk '/local-install-root/{print $2}')/bin/unison
cp $UCM /tmp/ucm/ucm
wget -O/tmp/unisonLocal.zip https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip
unzip -d /tmp/ucm/ui /tmp/unisonLocal.zip
tar -c -z -f ucm-linux.tar.gz -C /tmp/ucm .
- name: Upload linux artifact
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: build-linux
path: ucm-linux.tar.gz
build_macos:
name: "build_macos"
runs-on: macos-12
steps:
- uses: actions/checkout@v2
with:
ref: release/${{inputs.version}}
# Cache ~/.stack, keyed by the contents of 'stack.yaml'.
- uses: actions/cache@v3
name: cache ~/.stack (mac)
with:
path: ~/.stack
# Main cache key: commit hash. This should always result in a cache miss...
# So when loading a cache we'll always fall back to the restore-keys,
# which should load the most recent cache via a prefix search on the most
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-0_macOS-12-${{hashFiles('stack.yaml')}}-${{github.sha}}
# Fall-back to use the most recent cache for the stack.yaml, or failing that the OS
restore-keys: |
stack-0_macOS-12-${{hashFiles('stack.yaml')}}
stack-0_macOS-12
# Cache each local package's ~/.stack-work for fast incremental builds in CI.
- uses: actions/cache@v3
name: cache .stack-work
with:
path: |
**/.stack-work
# Main cache key: commit hash. This should always result in a cache miss...
# So when loading a cache we'll always fall back to the restore-keys,
# which should load the most recent cache via a prefix search on the most
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-work-3_macOS-12-${{github.sha}}
restore-keys: stack-work-3_macOS-12
- name: install stack (macOS)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-osx-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: remove ~/.stack/setup-exe-cache on macOS
run: rm -rf ~/.stack/setup-exe-cache
- name: build
run: |
# unison-cli embeds version numbers using TH
# so it needs to be forced to rebuild to ensure those are updated.
stack clean unison-cli
stack --no-terminal build --flag unison-parser-typechecker:optimized
- name: fetch latest Unison Local UI and package with ucm
run: |
mkdir -p /tmp/ucm/ui
UCM=$(stack path | awk '/local-install-root/{print $2}')/bin/unison
cp $UCM /tmp/ucm/ucm
wget -O/tmp/unisonLocal.zip https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip
unzip -d /tmp/ucm/ui /tmp/unisonLocal.zip
tar -c -z -f ucm-macos.tar.gz -C /tmp/ucm .
- name: Upload macos artifact
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: build-macos
path: ucm-macos.tar.gz
build_windows:
name: "build_windows"
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
with:
ref: release/${{inputs.version}}
# Cache ~/.stack, keyed by the contents of 'stack.yaml'.
- uses: actions/cache@v3
name: cache ~/.stack (Windows)
with:
path: "C:\\Users\\runneradmin\\AppData\\Roaming\\stack"
# Main cache key: commit hash. This should always result in a cache miss...
# So when loading a cache we'll always fall back to the restore-keys,
# which should load the most recent cache via a prefix search on the most
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-0_windows-2019-${{hashFiles('stack.yaml')}}-${{github.sha}}
# Fall-back to use the most recent cache for the stack.yaml, or failing that the OS
restore-keys: |
stack-0_windows-2019-${{hashFiles('stack.yaml')}}
stack-0_windows-2019
# Cache each local package's ~/.stack-work for fast incremental builds in CI.
- uses: actions/cache@v3
name: cache .stack-work
with:
path: |
**/.stack-work
# Main cache key: commit hash. This should always result in a cache miss...
# So when loading a cache we'll always fall back to the restore-keys,
# which should load the most recent cache via a prefix search on the most
# recent branch cache.
# Then it will save a new cache at this commit sha, which should be used by
# the next build on this branch.
key: stack-work-3_windows-2019-${{github.sha}}
restore-keys: stack-work-3_windows-2019
- name: install stack (windows)
working-directory: ${{ github.workspace }}
run: |
mkdir stack && cd stack
curl -L https://github.com/commercialhaskell/stack/releases/download/v2.9.1/stack-2.9.1-windows-x86_64.tar.gz | tar -xz
echo "$PWD/stack-"* >> $GITHUB_PATH
- name: build
run: |
# unison-cli embeds version numbers using TH
# so it needs to be forced to rebuild to ensure those are updated.
stack clean unison-cli
# Windows will crash on build intermittently because the filesystem
# sucks at managing concurrent file access;
# Just keep retrying on these failures.
tries=5
for (( i = 0; i < $tries; i++ )); do
stack --no-terminal build --flag unison-parser-typechecker:optimized && break;
done
- name: fetch latest Unison Local UI and package with ucm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Powershell
shell: pwsh
run: |
mkdir -p tmp\ui
mkdir -p release\ui
$UCM = .\stack\stack-2.9.1-windows-x86_64\stack.exe exec -- where unison
cp $UCM .\release\ucm.exe
Invoke-WebRequest -Uri https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip -OutFile tmp\unisonLocal.zip
Expand-Archive -Path tmp\unisonLocal.zip -DestinationPath release\ui
Compress-Archive -Path .\release\* -DestinationPath ucm-windows.zip
- name: Upload windows artifact
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: build-windows
path: ucm-windows.zip