-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (79 loc) · 2.42 KB
/
rolling-release.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
name: Rolling Release
on: workflow_dispatch
env:
# The default repo env will be 'ComputeStacks'; uppercase is not allowed.
GH_REPO: computestacks/controller
IMAGE_TAG: 9
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: cstacks
POSTGRES_DB: cstacks
POSTGRES_PASSWORD: cstacks
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
# Docker Hub image
image: redis:7
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: '--allow-insecure-entitlement network.host'
driver-opts: network=host
- name: Log into Github Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log into DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Version
run: echo "${{ env.IMAGE_TAG }}" > VERSION
- name: Build and push
id: build-and-push
uses: docker/build-push-action@v3
with:
context: .
push: true
allow: network.host
network: host
tags: |
cmptstks/controller:${{ env.IMAGE_TAG }}
cmptstks/controller:latest
ghcr.io/${{ env.GH_REPO }}:${{ env.IMAGE_TAG }}
ghcr.io/${{ env.GH_REPO }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
github_user=${{ github.actor }}
github_token=${{ secrets.GITHUB_TOKEN }}