Skip to content

Commit de8d82b

Browse files
committed
Push image ghcr
1 parent 4e3fb92 commit de8d82b

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed

.github/actions/build/action.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,24 @@ runs:
6363
uses: docker/metadata-action@v5
6464
with:
6565
images: ${{ steps.image.outputs.image }}
66+
flavor: |
67+
suffix=-next,onlatest=true
68+
latest=${{ needs.context.outputs.is_release_master == 'true' }}
6669
tags: |
67-
type=raw,value=latest,enable={{is_default_branch}}
68-
type=raw,value=staging,enable=${{ github.event_name == 'merge_group' }}
70+
# Only use `tag` version on published release
71+
type=ref,event=tag,enabled=${{ needs.context.outputs.is_release_tag == 'true' }}
72+
type=ref,event=branch
6973
type=ref,event=pr
70-
type=sha
7174
7275
- name: Build Image
73-
uses: docker/build-push-action@v5
76+
id: build
77+
uses: docker/bake-action@v4
7478
with:
75-
context: .
76-
platforms: linux/amd64
77-
pull: true
79+
targets: web
7880
push: ${{ inputs.push }}
7981
load: ${{ inputs.push == 'false' }}
80-
tags: ${{ steps.meta.outputs.tags }}
81-
cache-from: type=gha
82-
cache-to: type=gha,mode=max
83-
build-args: |
84-
VERSION=${{ steps.meta.outputs.tags }}
85-
NODE_ENV=${{ inputs.node_env }}
82+
set: |
83+
*.cache-from=type=registry,ref=${{ steps.cache.outputs.tag }}
84+
*.cache-to=type=registry,ref=${{ steps.cache.outputs.tag }},mode=max,compression-level=9,force-compression=true,ignore-error=true
85+
*.args.VERSION=${{ steps.meta.outputs.tags }}
86+
*.args.NODE_ENV=${{ inputs.node_env }}

.github/workflows/push.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
packages: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: ./.github/actions/build
20+
with:
21+
push: true
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
node_env: production
25+
26+

0 commit comments

Comments
 (0)