Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #164
This file contains 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: Haskell CI | |
on: [push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
ghc: ['8.10.7'] | |
include: | |
- os: ubuntu-latest | |
container: 'lierdakil/alpine-haskell:8.10.7-pwsh' | |
config: static-build-cabal-config | |
- os: windows-latest | |
config: dynamic-build-cabal-config | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: haskell/actions/setup@v1 | |
if: '!(matrix.container)' | |
with: | |
ghc-version: ${{matrix.ghc}} | |
cabal-version: '3.2' | |
- name: Cabal init | |
shell: pwsh | |
run: | | |
$store = Join-Path $pwd ".cabal-store" | |
New-Item -ItemType Directory -Force "$store" | |
cabal user-config init --force --augment="store-dir: $store" ` | |
--augment="install-method: copy" ` | |
--augment="overwrite-policy: always" | |
$bindir = Join-Path $store "bin" | |
echo "$bindir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Cabal update | |
run: cabal v2-update | |
- name: Copy build config | |
if: matrix.config | |
run: cp misc/${{ matrix.config }} ./cabal.project.local | |
- uses: actions/cache@v2 | |
id: cache | |
with: | |
path: .cabal-store | |
key: ${{runner.os}}-${{matrix.ghc}}-${{hashFiles('alpaca-parser-generator.cabal')}}-${{hashFiles('dist-newstyle/cache/plan.json')}} | |
restore-keys: | | |
${{runner.os}}-${{matrix.ghc}}-${{hashFiles('alpaca-parser-generator.cabal')}}-${{hashFiles('dist-newstyle/cache/plan.json')}} | |
${{runner.os}}-${{matrix.ghc}}-${{hashFiles('alpaca-parser-generator.cabal')}} | |
${{runner.os}}-${{matrix.ghc}} | |
- shell: bash | |
run: | | |
ls -l .cabal-store/ghc-${{matrix.ghc}}/ || true | |
rm -rvf .cabal-store/ghc-${{matrix.ghc}}/alpaca-* || true | |
rm -rvf .cabal-store/ghc-${{matrix.ghc}}/alpaca-* || true | |
rm -rvf .cabal-store/ghc-${{matrix.ghc}}/alpaca-* || true | |
- name: Install dependencies | |
run: | | |
cabal v2-install --installdir=".cabal-store/bin" alex | |
cabal v2-install --installdir=".cabal-store/bin" happy | |
cabal v2-build --only-dependencies --enable-tests | |
- name: Install | |
shell: bash | |
run: | | |
mkdir install | |
export GIT_DIR="$PWD/.git" | |
cabal v2-install --installdir=$PWD/install | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: build-${{ runner.os }} | |
path: install | |
release: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/[email protected] | |
name: Download all artifacts | |
- name: Repack assets | |
run: | | |
mkdir assets | |
tar cvJf assets/alpaca-parser-generator-macOS.tar.xz -C build-macOS alpaca | |
tar cvJf assets/alpaca-parser-generator-Linux.tar.xz -C build-Linux alpaca | |
7z a assets/alpaca-parser-generator-Windows.7z build-Windows/alpaca.exe | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: release-assets | |
path: assets | |
- name: Create release | |
if: contains(github.ref, 'tags/v') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -x | |
assets=() | |
for asset in assets/*; do | |
assets+=("-a" "$asset") | |
done | |
tag_name="${GITHUB_REF##*/}" | |
hub release create "${assets[@]}" -m "$tag_name" "$tag_name" |