iT邦幫忙

2023 iThome 鐵人賽

DAY 23
0
name: CI/CD Pipeline

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Set up Node.js
      uses: actions/setup-node@v2
      with:
        node-version: 14

    - name: Install dependencies
      run: npm ci

    - name: Run tests
      run: npm test

  deploy:
    needs: build
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Deploy to Heroku
      run: |
        heroku login -i
        heroku git:remote -a your-heroku-app-name
        git push heroku main

    - name: Notify on Slack
      uses: rtCamp/action-slack-notify@v2
      with:
        slack_url: ${{ secrets.SLACK_WEBHOOK_URL }}
        channel: your-slack-channel
        message: 'Deployment to production is complete.'

  notify:
    needs: deploy
    runs-on: ubuntu-latest

    steps:
    - name: Notify on Success
      if: failure()
      run: echo "Deployment failed" && exit 1
    - name: Notify


上一篇
<DAY22> Docker X Docker Compose 管理多個容器
下一篇
<DAY24>
系列文
擱淺中掙扎29
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言