-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (68 loc) · 1.97 KB
/
ci.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
75
76
77
name: CI
on:
workflow_call:
secrets:
CONTAINER_REGISTRY_TOKEN:
required: true
CONTAINER_REGISTRY_USERNAME:
required: true
CONTAINER_REGISTRY_ENDPOINT:
required: true
PAT:
required: true
workflow_dispatch:
repository:
required: true
type: string
description: "The repository to checkout"
image-name:
required: true
type: string
description: "The image name to build"
default: "ruby"
push:
tags:
- '*'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
repository: leadc0de/adonis-backend
token: ${{ secrets.PAT }}
fetch-tags: true
fetch-depth: 0
- name: Determine version
id: version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
- name: Add Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.CONTAINER_REGISTRY_ENDPOINT }}/hypolia/${{ inputs.image-name }}
tags: |
latest
buildcache
${{ steps.version.outputs.VERSION }}
- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
registry: ${{ secrets.CONTAINER_REGISTRY_ENDPOINT }}
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=hypolia/ruby:buildcache
cache-to: type=gha,mode=max,scope=hypolia/ruby:buildcache