Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fx publish workflow #3

Merged
merged 15 commits into from
Sep 15, 2024
Prev Previous commit
Next Next commit
Debugging
  • Loading branch information
spartan-ductduong committed Sep 15, 2024
commit 9711236542d9d35ccd03d66e410a5fb72831806e
35 changes: 29 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Publish to GHCR

on:
Expand Down Expand Up @@ -38,10 +39,32 @@ jobs:
username: ${{ github.actor }}
password: ${{ steps.github-app-token.outputs.token }}

- name: Build Docker image
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/gh-actions-git-secret-protector:v1.0.0 .
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Push Docker image
run: |
docker push ghcr.io/${{ github.repository_owner }}/gh-actions-git-secret-protector:v1.0.0
- name: Extract Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=auto
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}

- name: Build & push
uses: docker/build-push-action@v4
with:
context: .
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}