-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (104 loc) · 3.15 KB
/
docker-image.yml
File metadata and controls
122 lines (104 loc) · 3.15 KB
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
name: Docker Image CI
on:
push:
tags:
- v*
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
services:
testdb:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: chmod +x bin/* && sed -i "s/\r$//g" bin/* && sed -i 's/ruby\.exe$/ruby/' bin/*
- name: "Prepare test"
env:
RAILS_ENV: test
OTEL_LOG_LEVEL: error
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: >-
bun install
&& bun run build
&& bun run build:css
&& bin/rake parallel:create
&& bin/rake parallel:migrate
- name: "Run tests"
env:
RAILS_ENV: test
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
run: bin/rake parallel:test
generate-vi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate mk2.vi
run: sh ./mkvi.sh
shell: sh
- name: Upload vi artifact
uses: actions/upload-artifact@v4
with:
name: mk2.vi
path: mk2.vi
overwrite: true
build-push-debian:
needs:
- generate-vi
- test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download vi
uses: actions/download-artifact@v4
with:
name: mk2.vi
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
tags: |
type=semver,enable=true,pattern={{raw}}
type=semver,enable=true,pattern={{raw}},suffix=-mri
type=sha,enable=true,prefix=sha-,suffix=
type=sha,enable=true,prefix=sha-,suffix=-mri
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image (MRI)
id: push-mri
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation (MRI)
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push-mri.outputs.digest }}
push-to-registry: true