-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (71 loc) · 1.93 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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