Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push hanya pada saat git tag push dan package.json yang berubah #56

Merged
merged 38 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3bbcb55
feat: menambahkan path-filter
reacto11mecha Jul 20, 2024
6063819
fix: memperbaiki kurang tanda petik
reacto11mecha Jul 20, 2024
1b8d576
fix: menambahkan action checkout
reacto11mecha Jul 20, 2024
194f6a6
feat: menambahkan filter untuk mengecek apakah ada update dari masing…
reacto11mecha Jul 20, 2024
97fdaf6
fix: salah implementasi
reacto11mecha Jul 20, 2024
220da72
feat: trigger github action hanya pada saat push tag saja
reacto11mecha Jul 20, 2024
66e7b97
feat: menambahkan checkout ke baseline-docker
reacto11mecha Jul 20, 2024
ec53897
fix: bablas
reacto11mecha Jul 20, 2024
e10854f
feat: pindah ke step sendiri
reacto11mecha Jul 20, 2024
95f989f
chore: coba update web
reacto11mecha Jul 20, 2024
1732f89
fix: memperbaiki yang ke skip
reacto11mecha Jul 20, 2024
b442ac2
chore: coba update web
reacto11mecha Jul 20, 2024
5f5226b
feat: menambahkan fungsi rename versi
reacto11mecha Jul 21, 2024
456a4ec
chore: coba update attendance
reacto11mecha Jul 21, 2024
83a0f7a
feat: pindah ke env
reacto11mecha Jul 21, 2024
fca8166
chore: update lagi
reacto11mecha Jul 21, 2024
4c0f7ea
fix: salah tempat
reacto11mecha Jul 21, 2024
2b572d8
fix: lagi lagi update
reacto11mecha Jul 21, 2024
e84b4d4
chore: rebuild lagi
reacto11mecha Jul 21, 2024
aca39ce
chore: coba update processor
reacto11mecha Jul 21, 2024
4668ad7
fix: kelebihan pulak
reacto11mecha Jul 21, 2024
dba67eb
fix: biasaw
reacto11mecha Jul 21, 2024
99c4b27
chore: coba up lagi
reacto11mecha Jul 21, 2024
b360610
fix: jangan lupa titik koma
reacto11mecha Jul 21, 2024
07a4817
fix: semoga bener
reacto11mecha Jul 21, 2024
4f83d6f
fix: dikit lagi
reacto11mecha Jul 21, 2024
3a869a9
fix: kok ga ada
reacto11mecha Jul 21, 2024
918a0b7
chore: update (huft)
reacto11mecha Jul 21, 2024
9246404
chore: update lagi (huft**2)
reacto11mecha Jul 21, 2024
9850b84
feat: menambahkan fungsionalitas push ke repo docker
reacto11mecha Jul 21, 2024
13c61ec
fix: ubah pake manual
reacto11mecha Jul 21, 2024
3a2cb84
fix
reacto11mecha Jul 21, 2024
57c4a1f
fix
reacto11mecha Jul 21, 2024
b9446c6
fix
reacto11mecha Jul 21, 2024
3ce8111
fix: tanpa kurawal
reacto11mecha Jul 21, 2024
d271acd
fix: pindah jadi newline
reacto11mecha Jul 21, 2024
8254bb8
feat: menambahkan fungsi push
reacto11mecha Jul 21, 2024
0a2cb3e
feat: persiapan commit
reacto11mecha Jul 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 90 additions & 12 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,41 @@ name: Docker Image Build CI

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- main

jobs:
web:
if: github.repository == 'sora-vp/baseline'
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
web: ${{ steps.filter.outputs.web }}
processor: ${{ steps.filter.outputs.processor }}
attendance: ${{ steps.filter.outputs.attendance }}
chooser: ${{ steps.filter.outputs.chooser }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: filter
with:
base: HEAD
filters: |
web: 'apps/web/package.json'
processor: 'apps/processor/package.json'
attendance: 'apps/clients/attendance/package.json'
chooser: 'apps/clients/chooser/package.json'

web:
needs: changes
if: github.repository == 'sora-vp/baseline' && needs.changes.outputs.web == 'true'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -32,12 +56,12 @@ jobs:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sora-baseline-web:${{ github.ref_name }}

processor:
if: github.repository == 'sora-vp/baseline'

needs: changes
if: github.repository == 'sora-vp/baseline' && needs.changes.outputs.processor == 'true'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -57,12 +81,12 @@ jobs:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sora-baseline-processor:${{ github.ref_name }}

client-attendance:
if: github.repository == 'sora-vp/baseline'

needs: changes
if: github.repository == 'sora-vp/baseline' && needs.changes.outputs.attendance == 'true'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -82,12 +106,12 @@ jobs:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sora-baseline-client-attendance:${{ github.ref_name }}

client-chooser:
if: github.repository == 'sora-vp/baseline'

needs: changes
if: github.repository == 'sora-vp/baseline' && needs.changes.outputs.chooser == 'true'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -105,3 +129,57 @@ jobs:
file: "./apps/clients/chooser/Dockerfile"
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sora-baseline-client-chooser:${{ github.ref_name }}

update-docker-compose-repo:
needs: [web, processor, client-attendance, client-chooser]
if: |
always()
&& (contains(needs.web.result, 'success') || contains(needs.processor.result, 'success') || contains(needs.client-attendance.result, 'success') || contains(needs.client-chooser.result, 'success'))
&& !contains(needs.*.result, 'failure')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.BASIC_DOCKER_CONFIG_REPO_PAT }}
repository: sora-vp/baseline-docker

- name: setup git config
run: |
git config --global user.name "github-actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Rename version
env:
WEB_UPDATE: ${{ needs.web.result }}
PROCESSOR_UPDATE: ${{ needs.processor.result }}
ATTENDANCE_UPDATE: ${{ needs.client-attendance.result }}
CHOOSER_UPDATE: ${{ needs.client-chooser.result }}
REF_NAME: ${{ github.ref_name }}
run: |
echo "WEB_UPDATE: $WEB_UPDATE"
echo "PROCESSOR_UPDATE: $PROCESSOR_UPDATE"
echo "ATTENDANCE_UPDATE: $ATTENDANCE_UPDATE"
echo "CHOOSER_UPDATE: $CHOOSER_UPDATE"

if [ "$WEB_UPDATE" == "success" ]; then
sed -i 's/rmecha\/sora-baseline-web:[^ ]*/rmecha\/sora-baseline-web:'"$REF_NAME"'/' docker-compose.yml
fi
if [ "$PROCESSOR_UPDATE" == "success" ]; then
sed -i 's/rmecha\/sora-baseline-processor:[^ ]*/rmecha\/sora-baseline-processor:'"$REF_NAME"'/' docker-compose.yml
fi
if [ "$ATTENDANCE_UPDATE" == "success" ]; then
sed -i 's/rmecha\/sora-baseline-client-attendance:[^ ]*/rmecha\/sora-baseline-client-attendance:'"$REF_NAME"'/' docker-compose.yml
fi
if [ "$CHOOSER_UPDATE" == "success" ]; then
sed -i 's/rmecha\/sora-baseline-client-chooser:[^ ]*/rmecha\/sora-baseline-client-chooser:'"$REF_NAME"'/' docker-compose.yml
fi

- name: Commit changes
env:
REF_NAME: ${{ github.ref_name }}
GITHUB_SHA: ${{ github.sha }}
run: |
git commit -am "bot-update: update $REF_NAME" -m "Cek commit -> https://github.com/sora-vp/baseline/commit/$GITHUB_SHA"

- name: Push 🚀
run: git push origin main
2 changes: 1 addition & 1 deletion apps/clients/attendance/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sora-vp/client-attendance",
"private": true,
"version": "2.3.1",
"version": "2.3.0",
"type": "module",
"scripts": {
"build": "yarn with-env vite build",
Expand Down
1 change: 1 addition & 0 deletions apps/processor/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@sora-vp/processor",
"version": "2.3.1",
"private": true,
"type": "module",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sora-vp/web",
"version": "0.1.0",
"version": "0.1.3",
"private": true,
"type": "module",
"scripts": {
Expand Down