mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: Build and push Docker image
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
environment: Production
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to AliYun Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: registry.cn-guangzhou.aliyuncs.com
|
|
username: ${{ secrets.ALI_USERNAME }}
|
|
password: ${{ secrets.ALI_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
hamster1963/nezha-dash
|
|
registry.cn-guangzhou.aliyuncs.com/hamster-home/nezha-dash
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=ref,event=tag
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|