Skip to content

Commit 7e7327c

Browse files
authored
Create docker-build-and-publish.yml
1 parent c08ae77 commit 7e7327c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: docker-build-and-publish
2+
3+
on:
4+
push:
5+
branches: none
6+
pull_request:
7+
branches: none
8+
workflow_dispatch:
9+
10+
jobs:
11+
build-and-publish-containers:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
service:
16+
- auth
17+
- blog
18+
- character
19+
- discovery
20+
- gateway
21+
- rss
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
26+
27+
# Generate a timestamp and store it in an environment variable
28+
- name: Set Timestamp
29+
id: timestamp
30+
run: echo "::set-output name=timestamp::$(date +%s)"
31+
32+
- name: Build Docker Image
33+
working-directory: ${{ matrix.service }}
34+
run: |
35+
docker build . --file Dockerfile --tag ghcr.io/${{ github.repository_owner }}/org-sog-hq-${{ matrix.service }}:${{ steps.timestamp.outputs.timestamp }}
36+
37+
- name: Log into Docker registry
38+
run: echo "${{ secrets.WORKFLOW_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
39+
40+
- name: Push Docker Image to GitHub Packages
41+
run: |
42+
docker push ghcr.io/${{ github.repository_owner }}/org-sog-hq-${{ matrix.service }}:${{ steps.timestamp.outputs.timestamp }}

0 commit comments

Comments
 (0)