-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
102 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Build & Push OCI Image to OCI Image Registry | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
dockerfile: | ||
required: true | ||
type: string | ||
images: | ||
required: true | ||
type: string | ||
secrets: | ||
ghcr-username: | ||
required: true | ||
ghcr-access-token: | ||
required: true | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check Out Repository | ||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | ||
|
||
- name: Set up QEMU for Docker Buildx | ||
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0 | ||
|
||
- name: Get version in Dockerfile | ||
id: version | ||
run: | | ||
echo "VERSION=$(cat Dockerfile | sed -n 's/.*postgresql:\([0-9.]*\).*/\1/p')" >> $GITHUB_OUTPUT | ||
- name: Seperate semver version | ||
id: semver | ||
run: | | ||
echo "MAJOR=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT | ||
echo "MINOR=$(echo $VERSION | cut -d. -f2)" >> $GITHUB_OUTPUT | ||
echo "PATCH=$(echo $VERSION | cut -d. -f3)" >> $GITHUB_OUTPUT | ||
- name: Generate Docker image metadata | ||
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # v4.6.0 | ||
id: meta | ||
with: | ||
images: ${{ inputs.images }} | ||
tags: | | ||
${{ steps.semver.outputs.MAJOR }} | ||
${{ steps.semver.outputs.MAJOR }}.${{ steps.semver.outputs.MINOR }} | ||
${{ steps.semver.outputs.MAJOR }}.${{ steps.semver.outputs.MINOR }}.${{ steps.semver.outputs.PATCH }} | ||
- name: Login to GitHub Container Registry | ||
if: ${{ github.event_name != 'pull_request' }} | ||
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.ghcr-username }} | ||
password: ${{ secrets.ghcr-access-token }} | ||
|
||
- name: Build and push the Docker image from the specified Dockerfile | ||
id: docker_build | ||
uses: docker/build-push-action@1104d471370f9806843c095c1db02b5a90c5f8b6 # v3.3.1 | ||
with: | ||
context: . | ||
file: ${{ inputs.dockerfile }} | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name == 'push' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build & Push Postgres 16 OCI Image to OCI Image Registry | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "16/Dockerfile" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "16/Dockerfile" | ||
|
||
jobs: | ||
version: | ||
runs-on: ubuntu-latest | ||
build: | ||
uses: ./.github/workflows/build.yaml | ||
with: | ||
dockerfile: "16/Dockerfile" | ||
images: | | ||
ghcr.io/${{ github.repository_owner }}/postgres | ||
secrets: | ||
ghcr-username: ${{ github.repository_owner }} | ||
ghcr-access-token: ${{ secrets.GITHUB_TOKEN }} |
File renamed without changes.