Skip to content
Open

ok #81

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
b805afc
Add push.yaml
Nov 17, 2024
293420f
Add push.yaml
Nov 17, 2024
145792d
Add push.yaml2
Nov 17, 2024
d8b6921
Add push.yaml3
Nov 17, 2024
1fd273f
Add push.yaml3
Nov 17, 2024
aaebb3f
Add push.yaml3
Nov 17, 2024
0ada043
add 주석
r2d2c2 Feb 27, 2025
8863bd1
Merge branch 'sangwondevops:dev' into dev
r2d2c2 Feb 27, 2025
b15cfc0
add pull_r
r2d2c2 Feb 28, 2025
fccfbe5
Merge branch 'dev' of https://github.com/r2d2c2/github-actions into dev
r2d2c2 Feb 28, 2025
1c95c0b
add pull_r2
r2d2c2 Feb 28, 2025
f4c9ec3
add issue.yml
r2d2c2 Feb 28, 2025
4a62517
add issue_comment.yaml
r2d2c2 Feb 28, 2025
e856be8
add workflow_dispatch
r2d2c2 Feb 28, 2025
7526e8f
add workflow_dispatch
r2d2c2 Feb 28, 2025
edc270b
add workflow_dispatch
r2d2c2 Feb 28, 2025
5a40fe9
add workflow_dispatch
r2d2c2 Feb 28, 2025
de0e2ea
add multi
r2d2c2 Feb 28, 2025
258e4a9
add needs
r2d2c2 Feb 28, 2025
6254fc0
add rerun
r2d2c2 Feb 28, 2025
7de4fd8
add rerun
r2d2c2 Feb 28, 2025
0add6e2
add rerun
r2d2c2 Feb 28, 2025
f5a29c1
Update README.md
r2d2c2 Feb 28, 2025
19607a4
add checkout.yml
r2d2c2 Mar 5, 2025
bf5ac86
Merge branch 'dev' of https://github.com/r2d2c2/github-actions into dev
r2d2c2 Mar 5, 2025
a09f1d5
add context
r2d2c2 Mar 5, 2025
b3685a0
update context.yml
r2d2c2 Mar 5, 2025
741c96f
add branch_filter.yml
r2d2c2 Mar 5, 2025
cf4fb59
add path_filter.yml
r2d2c2 Mar 6, 2025
6548d85
update part1
r2d2c2 Mar 6, 2025
edfd41d
update path_filter
r2d2c2 Mar 6, 2025
c194eaa
update path_filter
r2d2c2 Mar 6, 2025
6ec0855
update push.yaml
r2d2c2 Mar 6, 2025
9282db0
update path update
r2d2c2 Mar 6, 2025
686ed40
update push update
r2d2c2 Mar 6, 2025
1f0084d
add tag
r2d2c2 Mar 6, 2025
f3e4ca9
add timeout
r2d2c2 Mar 6, 2025
68f18d1
add timeout
r2d2c2 Mar 6, 2025
1ebaeba
add timeout
r2d2c2 Mar 6, 2025
5f390b0
add timeout
r2d2c2 Mar 6, 2025
8bd8cb9
add timeout update
r2d2c2 Mar 6, 2025
b4a8611
add cacha.yml
r2d2c2 Mar 6, 2025
21c46f1
add cacha.yml
r2d2c2 Mar 6, 2025
0abb74d
add cacha.yml
r2d2c2 Mar 6, 2025
bcff1d1
add cacha.yml
r2d2c2 Mar 6, 2025
3bd3f37
add cacha.yml
r2d2c2 Mar 6, 2025
38d5c8d
my cacha.yml
r2d2c2 Mar 6, 2025
5d4d6fe
my cacha.yml
r2d2c2 Mar 6, 2025
96f0f75
my cacha.yml
r2d2c2 Mar 6, 2025
809acad
my cacha.yml
r2d2c2 Mar 6, 2025
543c5a6
add artifact.yml
r2d2c2 Mar 6, 2025
55b07ce
add artifact.yml
r2d2c2 Mar 6, 2025
88c843d
add artifact.yml
r2d2c2 Mar 6, 2025
a969622
add artifact.yml
r2d2c2 Mar 6, 2025
bb0076c
add ouput
r2d2c2 Mar 6, 2025
ba6457b
add ouput
r2d2c2 Mar 6, 2025
db52823
test_output2.yml
r2d2c2 Mar 7, 2025
aef9fb7
test_output2.yml
r2d2c2 Mar 7, 2025
687815b
test_output2.yml
r2d2c2 Mar 7, 2025
b8bcfa3
test_output2.yml
r2d2c2 Mar 7, 2025
43ace8d
add var-1.yml
r2d2c2 Mar 7, 2025
5a3ba3f
add var2.yml
r2d2c2 Mar 7, 2025
ded9253
add secrets.yml
r2d2c2 Mar 7, 2025
ea6c0bf
environment.yml
r2d2c2 Mar 7, 2025
91fa8cd
add matrix
r2d2c2 Mar 8, 2025
ac27916
add matrix
r2d2c2 Mar 8, 2025
600ab0a
add if-1
r2d2c2 Mar 8, 2025
a7e5ef4
add if-1
r2d2c2 Mar 8, 2025
23a53bc
add if-1
r2d2c2 Mar 8, 2025
a6a3584
add if-2.yml
r2d2c2 Mar 8, 2025
1ad422f
add if-2.yml
r2d2c2 Mar 8, 2025
2eb2a55
add if-2.yml
r2d2c2 Mar 8, 2025
740259b
add string.yml
r2d2c2 Mar 8, 2025
e14842f
add string.yml
r2d2c2 Mar 8, 2025
7701f03
add string.yml
r2d2c2 Mar 8, 2025
63b6e47
add create_repo.yml
r2d2c2 Mar 11, 2025
9593ad7
add create_repo.yml
r2d2c2 Mar 11, 2025
b5aacfa
add create_repo.yml
r2d2c2 Mar 11, 2025
99f7236
add create_repo.yml
r2d2c2 Mar 11, 2025
5148d7d
add create_repo.yml
r2d2c2 Mar 11, 2025
8f616ba
add create_repo.yml
r2d2c2 Mar 11, 2025
1de67ce
add create_repo.yml
r2d2c2 Mar 11, 2025
e9a1c51
add create_repo.yml
r2d2c2 Mar 11, 2025
74192b3
add create_repo_slack
r2d2c2 Mar 12, 2025
d5d6977
add create_repo_slack
r2d2c2 Mar 12, 2025
5abd550
add create_repo_slack
r2d2c2 Mar 12, 2025
8541998
add create_repo_slack
r2d2c2 Mar 12, 2025
41f702e
add create_repo_slack
r2d2c2 Mar 12, 2025
2a6f160
add create_repo_slack
r2d2c2 Mar 12, 2025
e8f54be
add create_repo_slack2
r2d2c2 Mar 12, 2025
d663648
add create_repo_slack2
r2d2c2 Mar 12, 2025
c611ea2
add create_repo_slack2
r2d2c2 Mar 12, 2025
3373e51
add create_repo_slack2
r2d2c2 Mar 12, 2025
0ef0b95
add issue
r2d2c2 Mar 12, 2025
ba76274
add issue
r2d2c2 Mar 12, 2025
713ef67
add issue
r2d2c2 Mar 12, 2025
6988c94
add issue
r2d2c2 Mar 12, 2025
cad7636
add issue2
r2d2c2 Mar 12, 2025
d441f4c
add issue2
r2d2c2 Mar 12, 2025
890c67c
add issue2
r2d2c2 Mar 12, 2025
bb23ff4
add issue2
r2d2c2 Mar 12, 2025
2562b9d
add issue2
r2d2c2 Mar 12, 2025
348522d
add cicd-1.yml
r2d2c2 Mar 20, 2025
d50bc7e
Update App.js
r2d2c2 Mar 20, 2025
eb343dc
Update App.js
r2d2c2 Mar 20, 2025
cbb1aeb
Merge pull request #20 from r2d2c2/cicd-1
r2d2c2 Mar 20, 2025
8d86563
cicd1-1.yml
r2d2c2 Mar 20, 2025
0818ea8
Merge branch 'dev' of https://github.com/r2d2c2/github-actions into dev
r2d2c2 Mar 20, 2025
eccf7bb
Update App.js
r2d2c2 Mar 20, 2025
6d50c6a
Merge pull request #21 from r2d2c2/feature-cicd1-aws1
r2d2c2 Mar 20, 2025
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
118 changes: 118 additions & 0 deletions .github/workflows/cicd1-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: cicd-1
on:
pull_request:
types: [opened,synchronize,closed]
branches: [dev]
paths:
- 'my-app/**'
jobs:
test: # 테스트 작업
if: github.event.action == 'opened' || github.event.action == 'synchronize'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup-node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: |
cd my-app
npm ci
- name: npm build
run: |
cd my-app
npm run build


image-build: # 이미지 빌드 작업
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions: # 권한 설정
id-token: write
contents: read
steps:
- name: checkout
uses: actions/checkout@v4

- name: aws
id: credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{vars.AWS_REGION}}
role-to-assume: ${{secrets.AWS_ROLE_TO_ASSUME}}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'true'
- name: docker build & push
run: |
docker build -f Dockerfile -tag ${{secrets.REGISTRY}}/${{vars.REPOSITORY}}:${{github.sha}} .
docker push ${{secrets.REGISTRY}}/${{vars.REPOSITORY}}:${{github.sha}}


deploy: # 배포 작업
runs-on: ubuntu-latest
needs: [image-build] # image-build 스텝이 성공적으로 완료되면 실행
# 권한 설정
permissions:
id-token: write
contents: read
steps:
- name: checkout
uses: actions/checkout@v4

- name: aws
id: credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{vars.AWS_REGION}}
role-to-assume: ${{secrets.AWS_ROLE_TO_ASSUME}}
- name: setup kubectl
uses: azure/setup-kubectl@v3
with:
version: latest
- name: setup helm
uses: azure/setup-helm@v3
with:
version: v3.11.1

- name: access kubernetes
run: |
aws eks update-kubeconfig --name ${{vars.EKS_CLUSTER_NAME}}
- name: deploy
id: status
run: |
helm upgrade --install my-app kube/my-app --create-namespace --namespace my-app-${{vars.SUFFIX}} \
--set image.tag=${{github.sha}} \
--set image.repository=${{vars.REPOSITORY}}/${{vars.REPOSITORY}}
- name: notify
if: always()
# slack 알림
uses: slackapi/[email protected]
with:
webhook: ${{ secrets.SLACK_KEY }}
webhook-type: incoming-webhook
payload-templated: true
payload: |
{
"text":"message",
"blocks":[
{
"type":"section",
"text":{
"type":"mrkdwn",
"text":"Environment : dev, Deployed : ${{steps.status.outcome}}, Repository : ${{github.repository}}"
}
}
]
}
15 changes: 15 additions & 0 deletions .github/workflows/part1/issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: issue-workflow
on:
issues:
types: [opened] # issue가 열릴 때만 workflow 실행

jobs:
issue-job: #이슈가 트리거 되면 작동
runs-on: ubuntu-latest
steps:
- name: step1
run: echo "hello world"
- name: step2
run: |
echo "hello world2"
echo "hello world3"
17 changes: 17 additions & 0 deletions .github/workflows/part1/issue_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: issue-comment-workflow
on: issue_comment

jobs:
pr-comment:
if: ${{github.event.issue.pull_request}}
runs-on: ubuntu-latest
steps:
- name: pr comment
run: echo ${{github.event.issue.pull_request}}

issue-comment:
if: ${{!github.event.issue.pull_request}}
runs-on: ubuntu-latest
steps:
- name: issue comment
run: echo ${{github.event.issue.pull_request}}
18 changes: 18 additions & 0 deletions .github/workflows/part1/mutiple_event.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: mulitple-event-workflow
on:
push:
issues:
types: [opened]
# 푸쉬, 이슈,수동 트리거에서도 작동
workflow_dispatch:

jobs:
mulitple-event-job:
runs-on: ubuntu-latest
steps:
- name: mulitple event
run: echo "hello world"
- name: step2
run: |
echo hello world
echo gihub action
30 changes: 30 additions & 0 deletions .github/workflows/part1/needs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: needs
on: push

jobs:
job1:
runs-on: ubuntu-latest
steps:
- name: job1
run: echo "job1"

job2:
runs-on: ubuntu-latest
needs: [job1] # 종속성 설정
steps:
- name: job2
run: echo "job2"

job3:
runs-on: ubuntu-latest
steps:
- name: job3 # 동시에 실행
run: |
echo "job3 failed"
exit 1
job4:
runs-on: ubuntu-latest
needs: [job3] # 종속성 설정 job3이 실패하면 실행 안됨
steps:
- name: job4
run: echo "job4"
15 changes: 15 additions & 0 deletions .github/workflows/part1/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: pull_request-workflow
on:
pull_request:
#types: [opened, synchronize] # pull_request가 열리거나 업데이트 될 때 workflow 실행
types: [opened] # pull_request가 열릴 때만 workflow 실행
jobs:
push-job:
runs-on: ubuntu-latest
steps:
- name: step1
run: echo "hello world"
- name: step2
run: |
echo "hello world2"
echo "hello world3"
13 changes: 13 additions & 0 deletions .github/workflows/part1/push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: push-workflow
on: push #push 이벤트가 발생할 때 workflow 실행

jobs: # 잡 필수(하나 이상 필요)
push-job:
runs-on: ubuntu-latest # 실행 환경
steps:
- name: step1 # 단계 이름
run: echo "hello world" # 실행할 명령어
- name: step2 # 단계 이름
run: | # 여러 줄의 명령어 실행
echo "hello world2"
echo "hello world3"
13 changes: 13 additions & 0 deletions .github/workflows/part1/re-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: re-run
on: push

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: test
uses: actions/checkout@v4 # checkout 액션 사용
- name: test2
run: |
echo "test2"
cat README.md
33 changes: 33 additions & 0 deletions .github/workflows/part1/workflow_dispatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: workflow_dispatch-workflow
on:
workflow_dispatch:
inputs:
name:
description: 'set name'
required: true # 필수냐?
default: 'github-actions'
type: string
environment:
description: 'set env'
required: true
default: 'dev'
type: choice
options:
- dev
- prod
- qa

jobs:
workflow_dispatch-job:
runs-on: ubuntu-latest
steps:
- name: step1
run: echo "hello world"
- name: step2
run: |
echo "hello world2"
echo "hello world3"
- name: echo inputs
run: |
echo ${{ inputs.name }} # 입력받은 name 출력
echo ${{ inputs.environment }} # 입력받은 environment 출력
25 changes: 25 additions & 0 deletions .github/workflows/part2/artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: artifact
on: push
jobs:
upload-artifact:
runs-on: ubuntu-latest
steps:
- name: echo
run: echo hello-world > hello.txt
- name: upload artifact
uses: actions/upload-artifact@v4 # artifact 업로드 액션 사용
with:
name: artifact-test
path: ./hello.txt

download-artifact:
needs: [upload-artifact] # upload-artifact 잡이 성공적으로 완료되어야만 실행
runs-on: ubuntu-latest
steps:
- name: download artifact
uses: actions/download-artifact@v4 # artifact 다운로드 액션 사용
with:
name: artifact-test
path: ./ # 현재 디렉토리에 다운로드
- name: cat
run: cat hello.txt
11 changes: 11 additions & 0 deletions .github/workflows/part2/branch_filter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: branch-filter
on:
push: # push 이벤트 발생 시
branches: ["dev"] # dev 브래치에만 적용

jobs:
branch-filter:
runs-on: ubuntu-latest
steps:
- name: branch-filter
run: echo "branch-filter"
32 changes: 32 additions & 0 deletions .github/workflows/part2/cacha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: cache
on:
push:
paths:
- 'my-app/**' # myapp 디렉토리 내 파일이 변경되었을 때만 workflow 실행

jobs:
cache:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2 # 깃허브에서 제공하는 체크아웃 액션 사용
- name: setup-node
uses: actions/setup-node@v3 # 노드.js 설정 액션 사용
with:
node-version: 18
- name: Cache node.js modules
uses: actions/cache@v3 # 캐시 액션 사용
with:
path: ~/.npm # npm 패키지 캐시 경로
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# {{사용할 os}}-node-{{package-lock.json 파일의 해시값}}으로 키 생성
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: |
cd my-app
npm ci
- name: npm build
run: |
cd my-app
npm run build
20 changes: 20 additions & 0 deletions .github/workflows/part2/checkout.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: checkout
on: workflow_dispatch

jobs:
no-checkout: # github 레포지토리를 가지고 오지 않고 사용
runs-on: ubuntu-latest
steps:
- name: no-checkout # run 에러(README.md 파일이 없음)
run: |
echo "no-checkout"
cat README.md
checkout: # github 레포지토리를 가지고 와서 사용
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4 # checkout 액션 사용
- name: checkout2 # checkout 액션을 사용하여 README.md 파일을 가지고 와서 사용
run: |
echo "checkout2"
cat README.md
Loading