Skip to content

๐Ÿš€ ้‡‡้›†้€ป่พ‘้‡ๆž„ #10

๐Ÿš€ ้‡‡้›†้€ป่พ‘้‡ๆž„

๐Ÿš€ ้‡‡้›†้€ป่พ‘้‡ๆž„ #10

Workflow file for this run

name: CI
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Aliyun Hub
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.OPSRE_ALIHUB_USERNAME }}
password: ${{ secrets.OPSRE_ALIHUB_TOKEN }}
- name: Set env variables
id: set_env
run: |
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}"
echo "SHORT_SHA=${GITHUB_SHA:0:4}"
echo "DATE=$(TZ=Asia/Shanghai date +%Y-%m-%d.%H-%M-%S)"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
# ๆ‰€้œ€่ฆ็š„ไฝ“็ณป็ป“ๆž„๏ผŒๅฏไปฅๅœจ Available platforms ๆญฅ้ชคไธญ่Žทๅ–ๆ‰€ๆœ‰็š„ๅฏ็”จๆžถๆž„
platforms: linux/arm64,linux/amd64
# ้•œๅƒๆŽจ้€ๆ—ถ้—ด
push: ${{ github.event_name != 'pull_request' }}
build-args: |
VERSION=${{ env.DATE }}
tags: |
cairry/watchlog:latest
cairry/watchlog:${{ env.BRANCH_NAME }}_${{ env.DATE }}_${{ env.SHORT_SHA }}
registry.cn-hangzhou.aliyuncs.com/opsre/watchlog:latest
registry.cn-hangzhou.aliyuncs.com/opsre/watchlog:${{ env.BRANCH_NAME }}_${{ env.DATE }}_${{ env.SHORT_SHA }}