Skip to content

Commit b67e604

Browse files
authored
Merge pull request #10 from zMynxx/feature/test-cd-1
Feature/test cd 1
2 parents b0c1612 + e224ad6 commit b67e604

File tree

3 files changed

+57
-22
lines changed

3 files changed

+57
-22
lines changed

.github/workflows/cd.yaml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,24 +96,3 @@ jobs:
9696
project-demo/build/artifacts/release/MyApp.out
9797
ceedling-0.32.0-d76db35.gem
9898
LICENSE
99-
100-
# - name: Git Config
101-
# uses: zmynx/github-actions/.github/actions/git/git-config@feature/gha
102-
#
103-
# - name: Git Tag
104-
# uses: zmynx/github-actions/.github/actions/git/git-tag@feature/gha
105-
# with:
106-
# tag: "${{ format('{0}{1}', 'v', steps.new_tag.outputs.new_tag) }}"
107-
#
108-
# - name: Publish image to DockerHub
109-
# uses: docker/build-push-action@v5.1.0
110-
# with:
111-
# context: .
112-
# file: Dockerfile.ubuntu
113-
# platforms: linux/amd64
114-
# push: true
115-
# tags: |
116-
# ${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}:22.04-v${{ steps.new_tag.outputs.new_tag }}
117-
# ${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}:latest
118-
# cache-from: type=gha
119-
# cache-to: type=gha,mode=max

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
# Check every PR to main
88
pull_request:
99
branches:
10-
- "main"
10+
- main
1111

1212
jobs:
1313
docker-test:

.github/workflows/publish.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CD
2+
3+
on:
4+
# Publish a new image to Dockerhub on changes to Dockerfile
5+
push:
6+
paths:
7+
- Dockerfile.ubuntu
8+
9+
permissions:
10+
id-token: write
11+
contents: write
12+
packages: write
13+
14+
jobs:
15+
check:
16+
name: check pr status
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- name: check if PR is merged
20+
uses: zmynx/github-actions/.github/actions/git/check-merge@feature/gha
21+
22+
cd:
23+
name: continuous-deployment
24+
needs: [check]
25+
runs-on: ubuntu-22.04
26+
outputs:
27+
new_tag: ${{ steps.semver.outputs.new_tag }}
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
- name: Login to Docker Hub
39+
uses: docker/login-action@v3
40+
with:
41+
username: ${{ secrets.DOCKERHUB_USERNAME }}
42+
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+
# In case of a new image I'd like to publish
45+
- name: Publish image to DockerHub
46+
uses: docker/build-push-action@v5.1.0
47+
with:
48+
context: .
49+
file: Dockerfile.ubuntu
50+
platforms: linux/amd64
51+
push: true
52+
tags: |
53+
${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}:22.04-v0.32.0-d76db35-${{ github.sha }}
54+
${{ secrets.DOCKERHUB_USERNAME}}/${{ vars.DOCKERHUB_REPO }}:latest
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)