-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (27 loc) · 913 Bytes
/
build.yml
File metadata and controls
32 lines (27 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Build and Push to Aliyun
on:
push:
branches: [ "main", "master" ]
workflow_dispatch: # 允许手动触发
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Aliyun Container Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.ALIYUN_REGISTRY }}
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
# 同时推送 latest 标签和基于 commit hash 的标签
tags: |
${{ secrets.ALIYUN_REGISTRY }}/${{ secrets.IMAGE_NAME }}:latest
${{ secrets.ALIYUN_REGISTRY }}/${{ secrets.IMAGE_NAME }}:${{ github.sha }}