CI Pipeline #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Pipeline | |
on: | |
workflow_dispatch: | |
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: "18" # 根据需要修改 Node.js 版本 | |
- name: Clone and build family-flix/api | |
run: | | |
mkdir -p $HOME/api | |
git clone https://github.com/family-flix/api $HOME/api | |
cd $HOME/api | |
npm install | |
npm run build | |
- name: Clone and build family-flix/pc2 | |
run: | | |
mkdir -p $HOME/pc2 | |
git clone https://github.com/family-flix/pc2 $HOME/pc2 | |
cd $HOME/pc2 | |
pnpm install | |
npm run build | |
mkdir -p $HOME/api/dist/dist/assets/pc | |
mv $HOME/pc2/dist/* $HOME/api/dist/dist/assets/pc/ | |
- name: Clone and build family-flix/admin1 | |
run: | | |
mkdir -p $HOME/admin1 | |
git clone https://github.com/family-flix/admin1 $HOME/admin1 | |
cd $HOME/admin1 | |
pnpm install | |
npm run build | |
mkdir -p $HOME/api/dist/dist/assets/admin | |
mv $HOME/admin1/dist/* $HOME/api/dist/dist/assets/admin/ | |
- name: Clone and build family-flix/mobile1 | |
run: | | |
mkdir -p $HOME/mobile1 | |
git clone https://github.com/family-flix/mobile1 $HOME/mobile1 | |
cd $HOME/mobile1 | |
pnpm install | |
npm run build | |
mkdir -p $HOME/api/dist/dist/assets/mobile | |
mv $HOME/mobile1/dist/* $HOME/api/dist/dist/assets/mobile/ | |
- name: Build Docker image | |
run: | | |
cd $HOME/api | |
VERSION=$(jq -r '.version' package.json) | |
docker build -t ltaoo/family_flix:$VERSION . | |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin | |
docker push ltaoo/family_flix:$VERSION |