-
Notifications
You must be signed in to change notification settings - Fork 21
130 lines (113 loc) · 3.37 KB
/
ci.yml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: CI
on:
pull_request:
push:
branches: main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: x
AWS_SECRET_ACCESS_KEY: x
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: restyled_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- run: db/migrate test upgrade
- id: stack
uses: freckle/stack-action@v5
env:
REDIS_URL: redis://localhost:6379/15
- run: db/migrate prod check
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- uses: freckle/weeder-action@v2
with:
ghc-version: ${{ steps.stack.outputs.compiler-version }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
fail-on: warning
image:
runs-on: ubuntu-latest
outputs:
image: ${{ steps.prep.outputs.image }}
steps:
- id: prep
run: |
{
printf 'image=restyled/restyled.io:'
echo "${{ github.sha }}" | head -c7
} >>"$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/build-push-action@v5
with:
build-args: |
REVISION=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ steps.prep.outputs.image }}
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [build, image]
steps:
- run: |
cat >Dockerfile.web <<'EOM'
FROM ${{ needs.image.outputs.image }}
CMD ["/app/restyled.io"]
EOM
- uses: gonuit/heroku-docker-deploy@v1.3.3
with:
email: ${{ secrets.HEROKU_EMAIL }}
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: restyled-io
dockerfile_name: Dockerfile.web
- uses: restyled-io/gitops-deploy-action@main
with:
token: ${{ secrets.GITOPS_ACCESS_TOKEN }}
parameter-name: RestyledImage
parameter-value: ${{ needs.image.outputs.image }}
committer-name: Restyled Commits
committer-email: commits@restyled.io
repository: restyled-io/ops
stacks: cg-app/stacks/*/*/prod/services/sync-marketplace.yaml
- uses: desiderati/github-action-pushover@v1
if: ${{ always() }}
with:
job-status: ${{ job.status }}
pushover-api-token: ${{ secrets.PUSHOVER_API_TOKEN }}
pushover-user-key: ${{ secrets.PUSHOVER_USER_KEY }}