-
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.
Merge pull request #1 from pyar6329/add-github-action
Add GitHub Action config, and support ARM Linux
- Loading branch information
Showing
1 changed file
with
60 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,60 @@ | ||
--- | ||
name: Release | ||
on: [push] | ||
jobs: | ||
release: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
contents: read | ||
env: | ||
CONTAINER_REGISTRY: ghcr.io/pyar6329/postgres | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to Github Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Test Building Dockerfile | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: . | ||
file: ./Dockerfile | ||
push: false | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Get Docker image tag for Release | ||
id: release_tag | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
echo "tag=${GITHUB_REF:10}" >> $GITHUB_OUTPUT | ||
- name: Build PostgreSQL image and push it to GItHub Container Registry | ||
uses: docker/build-push-action@v5 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
IMAGE_TAG: release-${{ steps.release_tag.outputs.tag }} | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: | | ||
${{ env.CONTAINER_REGISTRY }}:${{ env.IMAGE_TAG }} | ||
${{ env.CONTAINER_REGISTRY }}:latest | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |