-
-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (124 loc) · 4.45 KB
/
main.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
131
name: Build & Test & Push Image
on:
push:
branches:
- "main"
- "develop"
tags:
- "v*"
pull_request:
branches:
- "main"
- "develop"
jobs:
featureflags:
runs-on: ubuntu-latest
name: "Validate & Push Feature Flags"
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: flipt-io/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: flipt validate
- name: Build and Push bundle
# only build and push feature flags from the develop branch
if: github.ref == 'refs/heads/develop'
env:
FLIPT_STORAGE_OCI_AUTHENTICATION_USERNAME: ${{ github.actor }}
FLIPT_STORAGE_OCI_AUTHENTICATION_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
flipt bundle build sitrep-featureflags:latest
flipt bundle push sitrep-featureflags:latest ghcr.io/f-eld-ch/sitrep/featureflags:develop
build:
runs-on: ubuntu-latest
name: "Test and Build"
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
cache-dependency-path: "ui/yarn.lock"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/f-eld-ch/sitrep
tags: |
# set latest tag for default branch / ordered by priority
type=semver,pattern={{version}},prefix=v,priority=920
type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'main') }},priority=910
type=raw,value=develop,enable={{is_default_branch}},priority=905
# priority 900
type=semver,pattern={{major}}.{{minor}},prefix=v
type=semver,pattern={{major}},prefix=v
# priority 700
type=edge,branch=develop
# priority 600
type=ref,event=branch
type=ref,event=pr,prefix=pr-,enable=true
- name: Install packages
run: yarn install --immutable
working-directory: ui
- name: Lint ui files
run: yarn lint
working-directory: ui
- name: Run ui tests
run: yarn test
working-directory: ui
- name: Build ui
run: yarn build
env:
VERSION: ${{ steps.meta.outputs.version }}
GIT_SHA: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
working-directory: ui
- uses: docker/login-action@v3
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ steps.meta.outputs.version }}
GIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
- name: Docker meta for hasura
id: meta-hasura
uses: docker/metadata-action@v5
with:
images: ghcr.io/f-eld-ch/sitrep-hasura
tags: |
# set latest tag for default branch
type=edge,branch=develop
type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=ref,event=branch
type=ref,event=pr,prefix=pr-,enable=true,priority=600
type=semver,pattern={{version}},prefix=v,priority=420
type=semver,pattern={{major}}.{{minor}},prefix=v,priority=410
type=semver,pattern={{major}},prefix=v,priority=400
type=sha
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.hasura
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-hasura.outputs.tags }}
labels: ${{ steps.meta-hasura.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max