Skip to content

Commit

Permalink
Merge pull request #1 from pyar6329/add-github-action
Browse files Browse the repository at this point in the history
Add GitHub Action config, and support ARM Linux
  • Loading branch information
pyar6329 authored May 22, 2024
2 parents 3b48f47 + cfd8631 commit ac6d9d5
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
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

0 comments on commit ac6d9d5

Please sign in to comment.