Skip to content

Commit

Permalink
Push image ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMind committed Jun 26, 2024
1 parent 4e3fb92 commit de8d82b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,24 @@ runs:
uses: docker/metadata-action@v5
with:
images: ${{ steps.image.outputs.image }}
flavor: |
suffix=-next,onlatest=true
latest=${{ needs.context.outputs.is_release_master == 'true' }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=staging,enable=${{ github.event_name == 'merge_group' }}
# Only use `tag` version on published release
type=ref,event=tag,enabled=${{ needs.context.outputs.is_release_tag == 'true' }}
type=ref,event=branch
type=ref,event=pr
type=sha
- name: Build Image
uses: docker/build-push-action@v5
id: build
uses: docker/bake-action@v4
with:
context: .
platforms: linux/amd64
pull: true
targets: web
push: ${{ inputs.push }}
load: ${{ inputs.push == 'false' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
VERSION=${{ steps.meta.outputs.tags }}
NODE_ENV=${{ inputs.node_env }}
set: |
*.cache-from=type=registry,ref=${{ steps.cache.outputs.tag }}
*.cache-to=type=registry,ref=${{ steps.cache.outputs.tag }},mode=max,compression-level=9,force-compression=true,ignore-error=true
*.args.VERSION=${{ steps.meta.outputs.tags }}
*.args.NODE_ENV=${{ inputs.node_env }}
26 changes: 26 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Push

on:
push:
branches:
- main
pull_request:

permissions:
packages: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/build
with:
push: true
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
node_env: production


0 comments on commit de8d82b

Please sign in to comment.