Skip to content

Commit a6c0380

Browse files
authored
chore(pipeline): adjust docker pipeline to push image to docker hub (#6)
* adjust pipeline to push docker image * add .idea folder to vcs
1 parent cab3481 commit a6c0380

File tree

9 files changed

+85
-6
lines changed

9 files changed

+85
-6
lines changed

.github/workflows/docker-build.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ name: CI and Docker Deploy
22

33
on:
44
push:
5-
branches: ['main', 'dev', 'staging']
5+
branches: ['main', 'dev']
66
tags: ['v*.*.*']
77
pull_request:
88
branches: ['dev']
9+
10+
env:
11+
# github.repository as <account>/<repo>
12+
IMAGE_NAME: mnestix-proxy
13+
# Update the version manually
14+
IMAGE_TAG_VERSION: 0.0.1
915

1016
jobs:
1117
run-tests:
@@ -36,6 +42,8 @@ jobs:
3642
name: Build images and push
3743
needs: run-tests
3844
runs-on: ubuntu-latest
45+
if: github.event_name != 'pull_request' && github.repository_owner == 'eclipse-mnestix' &&
46+
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
3947
permissions:
4048
contents: read
4149

@@ -47,16 +55,22 @@ jobs:
4755
uses: docker/setup-buildx-action@v3
4856

4957
- name: Login to DockerHub
50-
if: false #Skip for now
5158
uses: docker/login-action@v3
5259
with:
5360
username: ${{ secrets.DOCKER_USERNAME }}
54-
password: ${{ secrets.DOCKER_PASSWORD }}
55-
61+
password: ${{ secrets.DOCKER_API_TOKEN }}
62+
63+
- name: Extract branch name
64+
id: extract_branch
65+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
66+
5667
- name: Build and push Docker image
5768
uses: docker/build-push-action@v6
5869
with:
5970
context: "."
60-
push: false
71+
push: true
6172
platforms: linux/amd64,linux/arm64
62-
tags: mnestix/mnestix-proxy:latest
73+
tags: |
74+
${{ github.ref == 'refs/heads/main' && format('mnestix/{0}:{1}', env.IMAGE_NAME, env.IMAGE_TAG_VERSION) || '' }}
75+
${{ github.ref == 'refs/heads/main' && format('mnestix/{0}:latest', env.IMAGE_NAME) || '' }}
76+
${{ github.ref != 'refs/heads/main' && format('mnestix/{0}:{1}', env.IMAGE_NAME, steps.extract_branch.outputs.branch) || '' }}

.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.mnestix-proxy/.idea/.gitignore

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.mnestix-proxy/.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.mnestix-proxy/.idea/indexLayout.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.mnestix-proxy/.idea/vcs.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/indexLayout.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)