mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-26 23:06:37 +00:00
Merge pull request #1625 from Lokowitz/add-dev-images
Add docker dev image creation workflow for PRs
This commit is contained in:
75
.github/workflows/dev-image.yml
vendored
Normal file
75
.github/workflows/dev-image.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
name: Create Dev-Image
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- dev
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
TAG_URL: https://hub.docker.com/r/${{ vars.DOCKER_HUB_REPO }}/tags
|
||||||
|
TAG: ${{ vars.DOCKER_HUB_REPO }}:dev-pr${{ github.event.pull_request.number }}
|
||||||
|
TAG_PG: ${{ vars.DOCKER_HUB_REPO }}:postgresql-dev-pr${{ github.event.pull_request.number }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Build and push Docker image SQLITE
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.TAG }}
|
||||||
|
cache-from: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache,mode=max
|
||||||
|
build-args: DATABASE=sqlite
|
||||||
|
|
||||||
|
- name: Build and push Docker image PG
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.TAG_PG }}
|
||||||
|
cache-from: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache-pg
|
||||||
|
cache-to: type=registry,ref=${{ vars.DOCKER_HUB_REPO }}:buildcache-pg,mode=max
|
||||||
|
build-args: DATABASE=pg
|
||||||
|
|
||||||
|
- uses: actions/github-script@v8
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const repoUrl = process.env.TAG_URL;
|
||||||
|
const tag = process.env.TAG;
|
||||||
|
const tagPg = process.env.TAG_PG;
|
||||||
|
github.rest.issues.createComment({
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
body: `👋 Thanks for your PR!
|
||||||
|
Dev images for this PR are now available on [docker hub](${repoUrl}):
|
||||||
|
|
||||||
|
**SQLITE Image:**
|
||||||
|
\`\`\`
|
||||||
|
${tag}
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
**Postgresql Image:**
|
||||||
|
\`\`\`
|
||||||
|
${tagPg}
|
||||||
|
\`\`\``
|
||||||
|
})
|
||||||
|
|
||||||
Reference in New Issue
Block a user