포스트

[GitHub 100일 챌린지] Day 85 - Actions Marketplace 활용

[GitHub 100일 챌린지] Day 85 - Actions Marketplace 활용

100일 챌린지 Day 85 - GitHub Marketplace에서 유용한 Actions를 찾아 활용합니다.

배울 내용

  1. Marketplace 둘러보기
  2. 인기 Actions 활용
  3. Actions 버전 관리

GitHub Marketplace란?

개념

미리 만들어진 Actions를 공유하는 곳

1
2
3
4
5
6
7
8
9
Marketplace:
- 수천 개의 Actions
- 검증된 솔루션
- 무료/유료

장점:
- 직접 만들 필요 없음
- 검증된 코드
- 유지보수됨

접근 방법

1
2
1. https://github.com/marketplace?type=actions
2. Workflow 파일 편집 → 오른쪽 Marketplace 탭

필수 Actions

1. actions/checkout

코드 체크아웃 (필수!)

1
2
steps:
  - uses: actions/checkout@v4

옵션:

1
2
3
4
5
6
7
8
9
10
- uses: actions/checkout@v4
  with:
    # 서브모듈 포함
    submodules: true
    
    # 전체 히스토리 가져오기
    fetch-depth: 0
    
    # 특정 브랜치
    ref: develop

2. actions/setup-node

Node.js 환경 설정

1
2
3
4
5
6
- uses: actions/setup-node@v4
  with:
    node-version: '20'
    
    # package-lock.json 캐싱
    cache: 'npm'

여러 버전:

1
2
3
- uses: actions/setup-node@v4
  with:
    node-version-file: '.nvmrc'

3. actions/cache

의존성 캐싱으로 속도 향상

1
2
3
4
5
6
- uses: actions/cache@v3
  with:
    path: ~/.npm
    key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
    restore-keys: |
      ${{ runner.os }}-node-

효과:

1
2
Before: npm install 2분
After (캐시): npm install 10초

배포 Actions

1. peaceiris/actions-gh-pages

GitHub Pages 자동 배포

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
name: Deploy to GitHub Pages

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: 빌드
        run: npm run build
      
      - name: 배포
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: $
          publish_dir: ./dist

2. aws-actions/configure-aws-credentials

AWS 배포

1
2
3
4
5
6
7
8
- uses: aws-actions/configure-aws-credentials@v4
  with:
    aws-access-key-id: $
    aws-secret-access-key: $
    aws-region: us-east-1

- name: S3 배포
  run: aws s3 sync ./dist s3://my-bucket

테스트 & 품질 Actions

1. codecov/codecov-action

코드 커버리지 리포트

1
2
3
4
- uses: codecov/codecov-action@v3
  with:
    files: ./coverage/lcov.info
    flags: unittests

2. github/super-linter

다양한 언어 Lint

1
2
3
4
5
- uses: github/super-linter@v5
  env:
    VALIDATE_ALL_CODEBASE: false
    DEFAULT_BRANCH: main
    GITHUB_TOKEN: $

알림 Actions

1. 8398a7/action-slack

Slack 알림

1
2
3
4
5
6
- uses: 8398a7/action-slack@v3
  with:
    status: $
    text: '배포 완료!'
    webhook_url: $
  if: always()

2. appleboy/telegram-action

Telegram 알림

1
2
3
4
5
6
7
- uses: appleboy/telegram-action@master
  with:
    to: $
    token: $
    message: |
      ✅ 빌드 성공
      커밋: $

유틸리티 Actions

1. dorny/paths-filter

변경된 파일 감지

1
2
3
4
5
6
7
8
9
10
11
12
- uses: dorny/paths-filter@v2
  id: filter
  with:
    filters: |
      frontend:
        - 'src/**'
      backend:
        - 'api/**'

- name: Frontend 빌드
  if: steps.filter.outputs.frontend == 'true'
  run: npm run build

2. peter-evans/create-pull-request

자동 PR 생성

1
2
3
4
5
6
- uses: peter-evans/create-pull-request@v5
  with:
    commit-message: 'docs: Update README'
    title: '자동 문서 업데이트'
    body: '문서가 자동으로 업데이트되었습니다.'
    branch: auto-update-docs

Actions 버전 관리

버전 지정 방법

1
2
3
4
5
6
7
8
# 1. 특정 버전 (권장)
- uses: actions/checkout@v4

# 2. 특정 커밋 SHA
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab

# 3. 브랜치 (비권장 - 변경 가능)
- uses: actions/checkout@main

버전 업데이트

1
2
3
4
5
# Before
- uses: actions/checkout@v3

# After
- uses: actions/checkout@v4

주의사항:

1
2
3
4
변경 전 확인:
- Breaking changes 확인
- 릴리스 노트 읽기
- 테스트 환경에서 먼저 시도

실전 예제

풀스택 앱 CI/CD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Full Stack CI/CD

on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      
      - name: 의존성 설치
        run: npm ci
      
      - name: Lint
        uses: github/super-linter@v5
        env:
          VALIDATE_ALL_CODEBASE: false
          DEFAULT_BRANCH: main
          GITHUB_TOKEN: $
      
      - name: 테스트
        run: npm test
      
      - name: 커버리지
        uses: codecov/codecov-action@v3
  
  deploy:
    needs: test
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      
      - name: 빌드
        run: npm run build
      
      - name: GitHub Pages 배포
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: $
          publish_dir: ./dist
      
      - name: Slack 알림
        uses: 8398a7/action-slack@v3
        with:
          status: $
          text: '🚀 배포 완료!'
          webhook_url: $
        if: always()

Actions 찾는 팁

검색 키워드

1
2
3
4
5
6
7
8
목적별:
- deploy: "deploy to vercel", "aws deploy"
- test: "jest", "pytest", "coverage"
- lint: "eslint", "prettier", "super-linter"
- notify: "slack", "discord", "telegram"

언어별:
- "setup python", "setup java", "setup go"

선택 기준

1
2
3
4
5
6
7
8
9
10
✅ 좋은 Actions:
- ⭐ 별 많음 (1000+)
- 📝 문서 잘 정리됨
- 🔄 최근 업데이트됨
- ✅ GitHub 공식 또는 인증됨

❌ 피해야 할 Actions:
- 오래된 업데이트 (1년+)
- 문서 부족
- 이슈 많고 방치됨

정리

완료 체크:

  • Marketplace 둘러보기
  • 필수 Actions 사용
  • 프로젝트에 Actions 적용

핵심 요약:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
필수 Actions:
- actions/checkout: 코드 가져오기
- actions/setup-*: 언어 환경 설정
- actions/cache: 속도 향상

배포:
- peaceiris/actions-gh-pages
- aws-actions/*

유틸:
- codecov: 커버리지
- super-linter: 코드 품질
- slack: 알림

버전 관리:
- @v4 형식 사용 (권장)
- 업데이트 전 확인

다음: Day 86 - 커스텀 Actions 만들기 →


← Day 85 | 전체 커리큘럼 | Day 86 →

이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.