Skip to content

CI

CI #94

Workflow file for this run

name: Build
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * 5"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install system dependencies
run: sudo ./install-deps
- name: Set up Stack
run: stack upgrade || curl -sSL https://get.haskellstack.org/ | sh -s - -f
- name: Set up cache
uses: actions/cache@v3
with:
key: stack
path: ~/.stack
- name: Install dependencies
run: |
stack --no-terminal --install-ghc test --only-dependencies
- name: Test
run: |
stack --no-terminal test
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Stack
run: stack upgrade || curl -sSL https://get.haskellstack.org/ | sh -s - -f
- name: Set up cache
uses: actions/cache@v3
with:
key: stack
path: ~/.stack
- name: Build
run: |
stack --no-terminal build --copy-bins --local-bin-path .
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate Docker tag
id: tag
uses: frabert/[email protected]
with:
pattern: '^refs/tags/'
string: ${{ github.ref }}
replace-with: ''
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/koterpillar/multiblog:${{ steps.tag.outputs.replaced }},
ghcr.io/koterpillar/multiblog:latest