Skip to content

Commit

Permalink
update action
Browse files Browse the repository at this point in the history
  • Loading branch information
Boomboomdunce committed Dec 1, 2024
1 parent be97abf commit fce8632
Showing 1 changed file with 44 additions and 30 deletions.
74 changes: 44 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,48 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: Extract Metadata for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{github.repository}}
ghcr.io/${{github.repository}}
tags: |
type=ref,event=tag
type=edge,branch=main
# 检查代码
- name: Checkout Repository
uses: actions/checkout@v4

# 登录 Docker Hub
- name: Log In to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

# 设置 Docker Buildx
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: "v0.10.2"
driver: "docker-container"
buildkitd-flags: "--allow-insecure-entitlement security.insecure"

# 设置 QEMU(如果需要多架构支持,可启用)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

# 提取 Docker 元数据
- name: Extract Metadata for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
docker.io/${{ secrets.DOCKER_USER }}/hysteria2-client
tags: |
type=ref,event=tag
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and Push Docker Images
id: build
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64
tags: ${{steps.meta.outputs.tags}}
labels: ${{steps.meta.outputs.labels}}
# 构建并推送 Docker 镜像
- name: Build and Push Docker Images
id: build
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit fce8632

Please sign in to comment.