1
0
mirror of https://github.com/nitezs/sub2sing-box.git synced 2024-12-23 15:14:43 -05:00

update: github workflow

This commit is contained in:
Nite07 2024-03-19 17:13:04 +08:00
parent b05b7756a0
commit 675890f155
2 changed files with 49 additions and 18 deletions

48
.github/workflows/docker-dev.yaml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Build and Push Docker
on:
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_USERNAME }}/sub2sing-box
ghcr.io/${{ github.repository }}
tags: dev
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image to GHCR and Docker Hub
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
build-args: version=${{ github.sha }}
push: true
platforms: linux/amd64,linux/arm,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@ -2,11 +2,8 @@ name: Build and Push Docker
on:
push:
branches:
- dev
tags:
- "*"
workflow_dispatch:
jobs:
build-and-push:
@ -37,20 +34,6 @@ jobs:
${{ secrets.DOCKER_HUB_USERNAME }}/sub2sing-box
ghcr.io/${{ github.repository }}
- name: Prepare args
id: prep
run: |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
VERSION="${{ github.sha }}"
fi
if [[ "$GITHUB_REF" == 'refs/heads/dev' ]]; then
VERSION="${{ github.sha }}"
fi
if [[ "$GITHUB_REF" == 'refs/tags/'* ]]; then
VERSION=$TAG_NAME
fi
echo "version=$VERSION" >> $GITHUB_ENV
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
@ -59,7 +42,7 @@ jobs:
with:
context: .
file: ./Dockerfile
build-args: version=${{ env.version }}
build-args: version=${{ github.ref_name }}
push: true
platforms: linux/amd64,linux/arm,linux/arm64
tags: ${{ steps.meta.outputs.tags }}