mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-01-10 15:18:46 +08:00
build:完善构建流程
This commit is contained in:
11
.github/workflows/docker-build-test.yml
vendored
11
.github/workflows/docker-build-test.yml
vendored
@@ -1,8 +1,5 @@
|
||||
name: Build and Push Multi-Arch Docker Image for Test
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
workflow_dispatch: # 添加手动触发
|
||||
jobs:
|
||||
build-and-push:
|
||||
@@ -12,6 +9,7 @@ jobs:
|
||||
packages: write # 必须授权以推送镜像
|
||||
env:
|
||||
REPO_NAME: ${{ github.repository }}
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
@@ -28,6 +26,12 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 登录到 Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: 设置 QEMU 支持多架构
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
@@ -42,3 +46,4 @@ jobs:
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ env.LOWER_NAME }}:test
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.LOWER_NAME }}:test
|
||||
|
||||
15
.github/workflows/docker-image.yml
vendored
15
.github/workflows/docker-image.yml
vendored
@@ -11,14 +11,17 @@ jobs:
|
||||
packages: write # 必须授权以推送镜像
|
||||
env:
|
||||
REPO_NAME: ${{ github.repository }}
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 设置小写镜像名称
|
||||
- name: 设置小写镜像名称和版本
|
||||
run: |
|
||||
LOWER_NAME=$(echo "$REPO_NAME" | tr '[:upper:]' '[:lower:]')
|
||||
echo "LOWER_NAME=$LOWER_NAME" >> $GITHUB_ENV
|
||||
VERSION=${GITHUB_REF#refs/tags/v}
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: 登录到 GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
@@ -27,6 +30,12 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 登录到 Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: 设置 QEMU 支持多架构
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
@@ -41,4 +50,6 @@ jobs:
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ env.LOWER_NAME }}:latest
|
||||
ghcr.io/${{ env.LOWER_NAME }}:${{ github.sha }}
|
||||
ghcr.io/${{ env.LOWER_NAME }}:${{ env.VERSION }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.LOWER_NAME }}:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.LOWER_NAME }}:${{ env.VERSION }}
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
"build:frontend": "cd frontend && npm run build",
|
||||
"build:backend": "cd backend && npm run build",
|
||||
"clean": "rimraf **/node_modules **/dist",
|
||||
"version:patch": "npm version patch -w frontend && npm version patch",
|
||||
"version:minor": "npm version minor -w frontend && npm version minor",
|
||||
"version:major": "npm version major -w frontend && npm version major",
|
||||
"format": "prettier --write \"**/*.{js,ts,vue,json,css,scss}\"",
|
||||
"format:check": "prettier --check \"**/*.{js,ts,vue,json,css,scss}\"",
|
||||
"format:all": "npm run format && npm run lint:fix",
|
||||
|
||||
Reference in New Issue
Block a user