-
Notifications
You must be signed in to change notification settings - Fork 4
81 lines (78 loc) · 2.11 KB
/
test.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
name: Test & Build
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: Install npm modules
run: |
npm ci
- name: Copy config
run: |
sed 's/development:/production:/' config/guildbook.yml.example > config/guildbook.yml
- name: Build assets
run: |
npm run build
- name: Test
run: |
bundle exec rspec
build:
needs:
- test
runs-on: ubuntu-latest
steps:
- id: time
run: |
echo "time=$(TZ=UTC date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT
- id: meta
name: Docker meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/guildbook
tags: |
type=raw,value={{sha}}-${{ steps.time.outputs.time }}
- id: meta-assets
name: Docker meta for assets
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/guildbook-assets
tags: |
type=raw,value={{sha}}-${{ steps.time.outputs.time }}
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- uses: docker/build-push-action@v5
with:
target: app
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: docker/build-push-action@v5
with:
target: assets
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta-assets.outputs.tags }}
labels: ${{ steps.meta-assets.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max