Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Build and push image to ghcr #177

Merged
merged 1 commit into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- main
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE: ${{ github.repository }}

jobs:
run_tests:
runs-on: ubuntu-latest
Expand All @@ -30,6 +34,40 @@ jobs:
run: |
./gradlew clean test

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Define image meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE }}
tags: |
type=raw,value=sha-${{ github.sha }}
labels: |
org.opencontainers.image.authors=epoc
org.opencontainers.image.vendor=three.consulting
flavor: |
latest=true

- name: Build and push image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
no-cache: false
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

build_and_push:
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- synchronize
- reopened

env:
REGISTRY: ghcr.io
IMAGE: ${{ github.repository }}

jobs:
run_tests_and_build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -34,6 +38,19 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Define image meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE }}
tags: |
type=raw,value=sha-${{ github.sha }}
labels: |
org.opencontainers.image.authors=epoc
org.opencontainers.image.vendor=three.consulting
flavor: |
latest=true

- name: Test building image
uses: docker/build-push-action@v4
with:
Expand Down