From f3ca49dcdba6e8746f73785045de3a66c6fcca01 Mon Sep 17 00:00:00 2001 From: iqbalpa Date: Wed, 9 Jul 2025 07:05:42 +0700 Subject: [PATCH 1/4] ci: init cicd --- .github/workflows/build.yml | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..60f6db0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build devtasker docker image + +on: + pull_request: + branches: + - master + paths-ignore: + - '*.md' + - .gitignore + - '**/docs/**' + push: + branches: + - master + - '**/ci**' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Docker Hub Authentication + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Generate Docker tag + id: tag + run: | + if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then + echo "tag=latest" >> $GITHUB_OUTPUT + else + echo "tag=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT + fi + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ steps.tag.outputs.tag }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ github.sha }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file From eb5bb986384de030d08a224e4a2ba7303c3f8b59 Mon Sep 17 00:00:00 2001 From: iqbalpa Date: Wed, 9 Jul 2025 07:15:15 +0700 Subject: [PATCH 2/4] docs: update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 708aa16..7023015 100644 --- a/README.md +++ b/README.md @@ -16,5 +16,6 @@ These are things that I want to implement here. - [ ] Unit Testing - [x] Monitoring (prometheus) - [x] Docker +- [x] CI/CD - [ ] GraphQL API - [ ] gRPC Layer From 88293456ab376b25f76c7447f4f80c5d04ea19fc Mon Sep 17 00:00:00 2001 From: iqbalpa Date: Wed, 9 Jul 2025 07:16:11 +0700 Subject: [PATCH 3/4] ci: update conditions --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 60f6db0..1e4f999 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,10 @@ on: branches: - master - '**/ci**' + paths-ignore: + - '*.md' + - .gitignore + - '**/docs/**' jobs: publish: From 9c0d92dd8c2176ab0ca8a47c0a208bfe926ae5ff Mon Sep 17 00:00:00 2001 From: iqbalpa Date: Wed, 9 Jul 2025 07:18:16 +0700 Subject: [PATCH 4/4] chore: update version build-push-action --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e4f999..d3065b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: fi - name: Build and Push Docker Image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . push: true