name: CI/CD
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [13.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}
- name: Install packages
run: npm install
- name: Build
run: npm run build
- name: Upload staticfiles to Aliyun OSS
uses: manyuanrong/setup-ossutil@v1.0
with:
endpoint: ${{ secrets.OSS_ENDPOINT }}
access-key-id: ${{ secrets.OSS_ID }}
access-key-secret: ${{ secrets.OSS_KEY }}
- run: ossutil cp -rf build/ oss://<myoss>
- name: Dockerize
id: dockerize
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: ${{ secrets.DOCKER_URL }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}
snapshot: true
- name: Send docker image tag to telegram
uses: appleboy/telegram-action@master
with:
token: ${{ secrets.TG_BOT_TOKEN }}
to: ${{ secrets.TG_BOT_TO }}
message: "${{ github.repository }} uploaded a new docker image: ${{ secrets.DOCKER_URL }}:${{ steps.dockerize.outputs.snapshot-tag }}"
如果用 docker-compose 来管理多个项目,各位的 CI/CD 是怎么做的呢?如果有 test 以及 prod 环境又有什么高见呢?
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.