Skip to content

Bump CI

Bump CI #74

Workflow file for this run

name: Binaries
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
stack: ["2.9.3"]
ghc: ["9.2.5"]
steps:
- name: Get the version
id: get_version
run: 'echo ::set-output name=version::${GITHUB_REF#refs/tags/}'
- uses: actions/checkout@v4
- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: |
~/.stack
.stack-work
key: "${{ runner.os }}-stack-${{ matrix.stack }}-ghc-${{ matrix.ghc }}-${{ hashFiles('goldplate.cabal', 'stack.yaml', 'stack.yaml.lock') }}"
restore-keys: "${{ runner.os }}-stack-${{ matrix.stack }}-ghc-${{ matrix.ghc }}-"
- name: Setup Haskell Stack
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
stack-no-global: true
stack-setup-ghc: true
- name: Build
run: stack build
- name: Create artifact
if: startsWith(github.ref, 'refs/tags/v')
run: |
PLATFORM=$(uname | tr 'A-Z' 'a-z')
VERSION=${{ steps.get_version.outputs.version }}
cp $(stack path --local-install-root)/bin/goldplate goldplate
tar -czf goldplate.tar.gz goldplate
mkdir -p artifacts
mv goldplate.tar.gz artifacts/goldplate-$VERSION-$PLATFORM-x86_64.tar.gz
- uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
path: artifacts/*
name: artifacts-${{ runner.os }}-${{ matrix.ghc }}
release:
name: Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Get the version
id: get_version
run: 'echo ::set-output name=version::${GITHUB_REF#refs/tags/}'
- uses: actions/download-artifact@v4
with:
pattern: artifacts-*
- name: Display structure of downloaded files
run: ls -R
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.version }}
release_name: ${{ steps.get_version.outputs.version }}
- name: Upload Linux Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./goldplate-${{ steps.get_version.outputs.version }}-linux-x86_64.tar.gz
asset_name: goldplate-${{ steps.get_version.outputs.version }}-linux-x86_64.tar.gz
asset_content_type: application/gzip
- name: Upload MacOS Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./goldplate-${{ steps.get_version.outputs.version }}-darwin-x86_64.tar.gz
asset_name: goldplate-${{ steps.get_version.outputs.version }}-darwin-x86_64.tar.gz
asset_content_type: application/zip