mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
Make CD Clean (#159)
* Make CD Clean * Optimize CI as well * Fix CI * Fix CI
This commit is contained in:
parent
2a70de43ae
commit
c15241662e
17
.github/workflows/CI.yaml
vendored
17
.github/workflows/CI.yaml
vendored
@ -43,13 +43,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
@ -61,19 +58,13 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- name: Lower case for ghcr
|
|
||||||
id: ghcr_string
|
|
||||||
uses: ASzc/change-string-case-action@v1
|
|
||||||
with:
|
|
||||||
string: ${{ github.event.repository.full_name }}
|
|
||||||
|
|
||||||
- name: Build and load image
|
- name: Build and load image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
load: true
|
load: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ steps.ghcr_string.outputs.lowercase }}
|
ghcr.io/${{ github.event.repository.full_name }}:latest
|
||||||
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||||
@ -90,7 +81,7 @@ jobs:
|
|||||||
id: trivy
|
id: trivy
|
||||||
with:
|
with:
|
||||||
run: |
|
run: |
|
||||||
trivy image --no-progress --severity "HIGH,CRITICAL" ghcr.io/${{ steps.ghcr_string.outputs.lowercase }}
|
trivy image --no-progress --severity "HIGH,CRITICAL" ghcr.io/${{ github.event.repository.full_name }}
|
||||||
|
|
||||||
- name: Print CVE
|
- name: Print CVE
|
||||||
run: |
|
run: |
|
||||||
|
71
.github/workflows/release_docker_image.yaml
vendored
71
.github/workflows/release_docker_image.yaml
vendored
@ -15,12 +15,32 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Get the tag name
|
- name: Docker metadata
|
||||||
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/${{ github.event.repository.full_name }}
|
||||||
|
webpsh/webp_server_go
|
||||||
|
webpsh/webp-server-go
|
||||||
|
webpsh/webps
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
@ -36,53 +56,14 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Lower case for ghcr
|
|
||||||
id: ghcr_string
|
|
||||||
uses: ASzc/change-string-case-action@v1
|
|
||||||
with:
|
|
||||||
string: ${{ github.event.repository.full_name }}
|
|
||||||
|
|
||||||
- name: Build and push latest images
|
- name: Build and push latest images
|
||||||
if: ${{ github.ref == 'refs/heads/master' }}
|
uses: docker/build-push-action@v3
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/arm,linux/amd64,linux/arm64
|
platforms: linux/arm,linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
webpsh/webp_server_go
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
webpsh/webp-server-go
|
|
||||||
webpsh/webps
|
|
||||||
ghcr.io/${{ steps.ghcr_string.outputs.lowercase }}
|
|
||||||
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
|
||||||
|
|
||||||
- name: Build and push tagged images
|
|
||||||
if: ${{ github.ref != 'refs/heads/master' }}
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/arm,linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
webpsh/webp_server_go:${{ env.TAG }}
|
|
||||||
webpsh/webp-server-go:${{ env.TAG }}
|
|
||||||
webpsh/webps:${{ env.TAG }}
|
|
||||||
ghcr.io/${{ steps.ghcr_string.outputs.lowercase }}:${{ env.TAG }}
|
|
||||||
|
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||||
|
Loading…
x
Reference in New Issue
Block a user