Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
pyar6329 committed May 22, 2024
1 parent 3b48f47 commit 67d816a
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
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: Get Docker image tag for Release
id: release_tag
run: |
echo "tag=wip-0.0.1" >> $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 67d816a

Please sign in to comment.