-
Notifications
You must be signed in to change notification settings - Fork 10
159 lines (130 loc) · 5.46 KB
/
publish-alwatr-container.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Publish Alwatr Containers
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
branches:
- next
- main
pull_request:
paths:
- 'cloud/container/alwatr-*.dockerfile'
- '.github/workflows/publish-alwatr-container.yml'
env:
REGISTRY: ghcr.io
USERNAME: ${{github.repository_owner}}
# USERNAME: ${{github.actor}}
# USERNAME: Alwatr
jobs:
build:
if: github.repository_owner == 'AliMD'
name: Build Container
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# services
- image: comment
source: services/comment
dockerfile: cloud/container/alwatr-services.dockerfile
description: Alwatr Comment API Nanoservice, Distributed simple and fast comment nanoservice.
- image: flight-crawler
source: services/flight-crawler
dockerfile: cloud/container/alwatr-services.dockerfile
description: Alwatr Flight Crawler Nanoservice, Distributed simple and fast flight crawler nanoservice.
- image: form-registration
source: services/form-registration
dockerfile: cloud/container/alwatr-services.dockerfile
description: Alwatr Form Registration API Nanoservice, Distributed simple and fast nanoservice for registering form information.
- image: storage-server
source: services/storage-server
dockerfile: cloud/container/alwatr-services.dockerfile
description: Alwatr Storage Server, Elegant micro in-memory json-like storage nanoservice with disk backed, Fastest NoSQL Database.
- image: telegram-notifier
source: services/telegram-notifier
dockerfile: cloud/container/alwatr-services.dockerfile
description: Alwatr Telegram Notify Microservice, Distributed simple and fast telegram notify nanoservice.
# uniquely
- image: soffit-pwa
source: uniquely/soffit-pwa
dockerfile: cloud/container/alwatr-pwa.dockerfile
description: Soffit PWA.
- image: com-pwa
source: uniquely/com-pwa
dockerfile: cloud/container/alwatr-pwa.dockerfile
description: Customer Order Management PWA.
- image: keep-pwa
source: uniquely/keep-pwa
dockerfile: cloud/container/alwatr-pwa.dockerfile
description: Keep PWA.
- image: com-api
source: uniquely/com-api
dockerfile: cloud/container/alwatr-services.dockerfile
description: Customer Order Management API.
- image: flight-finder-api
source: uniquely/flight-finder-api
dockerfile: cloud/container/alwatr-services.dockerfile
description: Alwatr Flight Finder Application API.
# - image: flight-finder-pwa
# source: uniquely/flight-finder-pwa
# dockerfile: cloud/container/alwatr-pwa.dockerfile
# description: Alwatr Flight Finder PWA.
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: ⤵️ Checkout repository
uses: actions/[email protected]
- name: 🏗 Setup Docker Buildx
uses: docker/[email protected]
- name: 🏗 Log into registry ${{ env.REGISTRY }}
if: ${{ github.event_name != 'pull_request' }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏗 Extract metadata
id: meta
uses: docker/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
images: name=${{ env.REGISTRY }}/${{ env.USERNAME }}/${{ matrix.image }},enable=true
labels: |
org.opencontainers.image.title=@alwatr/${{ matrix.image }}
org.opencontainers.image.description=${{ matrix.description }}
tags: |
type=semver,enable=true,pattern={{major}}
type=semver,enable=true,pattern={{major}}.{{minor}}
type=semver,enable=true,pattern={{version}}
type=ref,enable=true,event=pr
type=ref,enable=true,event=branch
- name: 🚀 Build and push container image
id: build-and-push
uses: docker/[email protected]
with:
push: ${{ github.event_name != 'pull_request' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: .
file: ${{ matrix.dockerfile }}
build-args: |
PACKAGE_SOURCE=${{ matrix.source }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: 🏗 Install cosign
if: ${{ github.event_name != 'pull_request' }}
uses: sigstore/[email protected]
- name: 🏗 Sign the published container image
if: ${{github.event_name != 'pull_request'}}
env:
COSIGN_EXPERIMENTAL: 'true'
run: echo "${{steps.meta.outputs.tags}}" | xargs -I {} cosign sign --yes {}@${{steps.build-and-push.outputs.digest}}