-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: multi stage push
- Loading branch information
Showing
2 changed files
with
13 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
pull_request: | ||
branches: [main] | ||
schedule: | ||
- cron: '0 8 * * 5' | ||
- cron: "0 8 * * 5" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
@@ -19,14 +19,14 @@ jobs: | |
build_and_push: | ||
runs-on: self-hosted | ||
strategy: | ||
# Prevent a failure in one image from stopping the other builds | ||
fail-fast: false | ||
max-parallel: 1 | ||
fail-fast: true | ||
matrix: | ||
target: ["dev", "prod"] | ||
include: | ||
- context: "server" | ||
image: "base-server" | ||
platforms: "linux/amd64,linux/arm64" | ||
stages: "dev,runtime" | ||
|
||
steps: | ||
- name: Checkout | ||
|
@@ -55,24 +55,26 @@ jobs: | |
# Disable latest tag | ||
latest=false | ||
images: | | ||
name=ghcr.io/${{ github.repository_owner }}/${{matrix.image}} | ||
name=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}-${{ matrix.target }} | ||
tags: | | ||
# Tag scheduled runs with date | ||
type=schedule,pattern={{date 'YYYYMMDD'}},suffix=-${{ matrix.stages }} | ||
type=schedule,pattern={{date 'YYYYMMDD'}} | ||
# Tag with branch name | ||
type=ref,event=branch,suffix=-${{ matrix.stages }} | ||
type=ref,event=branch | ||
# Tag with pr-number | ||
type=ref,event=pr,suffix=-${{ matrix.stages }} | ||
type=ref,event=pr | ||
# Tag with git tag on release | ||
type=ref,event=tag,suffix=-${{ matrix.stages }} | ||
type=ref,event=tag | ||
- name: Build and push image | ||
uses: docker/[email protected] | ||
with: | ||
context: ${{ matrix.context }} | ||
target: ${{ matrix.target }} | ||
platforms: ${{ matrix.platforms }} | ||
# Skip pushing when PR from a fork | ||
push: ${{ !github.event.pull_request.head.repo.fork }} | ||
tags: ${{ steps.metadata.outputs.tags }} | ||
labels: ${{ steps.metadata.outputs.labels }} | ||
target: ${{ matrix.stages }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters