Skip to content

release testing-ignore-1 #286

release testing-ignore-1

release testing-ignore-1 #286

Workflow file for this run

name: "release"
run-name: "release ${{inputs.version}}"
defaults:
run:
shell: bash
# Current workflow:
# 1. Build the project on Linux, MacOS, and Windows.
# 2. Create a release from the artifacts.
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-ucm
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=0.5.19 #"$(${{ 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-ucm:
name: build ucm ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
steps:
- uses: actions/checkout@v2
with:
ref: release/${{inputs.version}}
- name: restore stack caches
uses: ./.github/workflows/actions/restore-stack-cache
with:
cache-prefix: release
work-cache-prefix: release
- name: install stack
uses: ./.github/workflows/actions/install-stack
- 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: set up environment
run: |
if [[ ${{runner.os}} = 'Windows' ]]; then
artifact_os="windows"
elif [[ ${{runner.os}} = 'macOS' ]]; then
artifact_os="osx"
elif [[ ${{runner.os}} = 'Linux' ]]; then
artifact_os="linux"
else
echo "Unexpected OS: ${{runner.os}}"
exit 1
fi
echo "artifact_os=$artifact_os" >> $GITHUB_ENV
- name: fetch latest Unison Local UI and package with ucm
run: |
if [[ ${{runner.os}} = 'Windows' ]]; then
cp $(stack exec -- where unison) /tmp/ucm/ucm.exe
else
cp $(stack exec -- which unison) /tmp/ucm/ucm
fi
wget -O/tmp/unisonLocal.zip https://github.com/unisonweb/unison-local-ui/releases/download/latest/unisonLocal.zip
mkdir -p /tmp/ucm/ui
unzip -d /tmp/ucm/ui /tmp/unisonLocal.zip
if [[ ${{runner.os}} = 'Windows' ]]; then
echo "artifact_archive=ucm-${{env.artifact_os}}.zip" >> $GITHUB_ENV
zip -r ${{env.artifact_archive}} /tmp/ucm
else
echo "artifact_archive=ucm-${{env.artifact_os}}.tar.gz" >> $GITHUB_ENV
tar -c -z -f ${{env.artifact_archive}} -C /tmp/ucm .
fi
- name: upload ${{env.artifact_os}} artifact (non-windows)
uses: actions/upload-artifact@v2
with:
if-no-files-found: error
name: build-${{env.artifact_os}}
path: ${{env.artifact_archive}}