Skip to content

Commit 81f7277

Browse files
committed
Add GitHub Actions workflow for Docker image build and publish
Configure CI/CD pipeline to automatically build and publish Docker images for gas-station and streamr-destination components to GitHub Container Registry on push, tag, or release events
1 parent c76d86b commit 81f7277

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build and Publish Docker Images
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- 'v*'
10+
release:
11+
types: [published]
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
GAS_STATION_IMAGE_NAME: ${{ github.repository }}/gas-station
16+
STREAMR_DEST_IMAGE_NAME: ${{ github.repository }}/streamr-destination
17+
18+
jobs:
19+
build-and-push:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
packages: write
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata (tags, labels) for Gas Station
37+
id: meta-gas
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.GAS_STATION_IMAGE_NAME }}
41+
tags: |
42+
type=ref,event=branch
43+
type=ref,event=pr
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=sha
47+
48+
- name: Extract metadata (tags, labels) for Streamr Destination
49+
id: meta-streamr
50+
uses: docker/metadata-action@v5
51+
with:
52+
images: ${{ env.REGISTRY }}/${{ env.STREAMR_DEST_IMAGE_NAME }}
53+
tags: |
54+
type=ref,event=branch
55+
type=ref,event=pr
56+
type=semver,pattern={{version}}
57+
type=semver,pattern={{major}}.{{minor}}
58+
type=sha
59+
60+
- name: Build and push Gas Station image
61+
uses: docker/build-push-action@v5
62+
with:
63+
context: .
64+
build-args: |
65+
path=sources/gas-station
66+
push: true
67+
tags: ${{ steps.meta-gas.outputs.tags }}
68+
labels: ${{ steps.meta-gas.outputs.labels }}
69+
70+
- name: Build and push Streamr Destination image
71+
uses: docker/build-push-action@v5
72+
with:
73+
context: .
74+
build-args: |
75+
path=destinations/streamr
76+
push: true
77+
tags: ${{ steps.meta-streamr.outputs.tags }}
78+
labels: ${{ steps.meta-streamr.outputs.labels }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ acceptance_tests_logs
1818
**/jenkins/data/.java
1919
**/jenkins/data/.lastStarted
2020
**/jenkins/data/*.log
21+
22+
/gitignore

0 commit comments

Comments
 (0)