Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Mar 10, 2024
1 parent 5e44bf1 commit fdf094f
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
tags:
- "*"
- "*"
pull_request:
branches: [main]

Expand All @@ -24,20 +24,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Generate short SHA
uses: benjlevesque/[email protected]
id: gen-short-sha

- name: Generate image info
id: gen-image-info
run: |
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
echo "::set-output name=image_name::${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ github.event.repository.name }}"
echo "::set-output name=image_tag::${{ github.ref }}"
else
echo "::set-output name=image_name::${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ github.event.repository.name }}"
echo "::set-output name=image_tag::$(echo ${{ github.ref_name }}-${{ steps.gen-short-sha.outputs.sha }} | tr '/' '-')"
fi
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_OWNER }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -54,6 +45,7 @@ jobs:
with:
context: .
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.gen-image-info.outputs.image_name }}:${{ steps.gen-image-info.outputs.image_tag }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit fdf094f

Please sign in to comment.