refactor: 再次重构昨日数据获取 #85
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: Push image on master | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' # 根据你的项目需要设置 Node.js 版本 | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build # 确保你的 package.json 中有一个 "build" 脚本 | |
- name: Test | |
run: npm test # 确保你的 package.json 中有一个 "test" 脚本 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: ./dist # 根据你的项目配置,调整构建输出目录路径 | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set environment | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3.3.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5.6.1 | |
with: | |
images: saltwood233/open93athome | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v6.10.0 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: saltwood233/open93athome:dev | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |