Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,73 @@ jobs:
cp docs/README_NPM.md app/README.md
cd app
npm publish --provenance --access public

docker-build-push:
name: Build and Push Docker Image
if: github.event.release.target_commitish == 'main' && vars.DOCKERHUB_USERNAME != ''
needs: [lint-test-app]
runs-on: ubuntu-latest
env:
REGISTRY: docker.io
IMAGE_NAME: weaponsforge/cloudinary-cli
permissions:
contents: read
security-events: write
packages: write
steps:
- name: Checkout the repository
uses: actions/checkout@v6
with:
ref: ${{ github.event.release.tag_name }}

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

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Generate Docker Image Tags and Labels
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and Push Docker Image
id: build
uses: docker/build-push-action@v6
with:
context: ./app
file: ./app/Dockerfile
target: production
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILDKIT_INLINE_CACHE=1
CACHEBUST=${{ github.run_id }}

- name: Scan Image for Vulnerabilities
uses: aquasecurity/trivy-action@v0.35.0
with:
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
format: 'sarif'
output: 'trivy-results.sarif'

- name: Upload Trivy Scan Results to GitHub Security Tab
uses: github/codeql-action/upload-sarif@v4
if: always()
with:
sarif_file: 'trivy-results.sarif'
Loading