diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index d4c9bbf..de75666 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -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 }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..8fbb2fa --- /dev/null +++ b/.github/workflows/push.yml @@ -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 + +