Skip to content

Commit

Permalink
Publish to ghcr
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Aug 21, 2023
1 parent 5bb59d4 commit 4b315a8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish_ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy Images to GHCR

on:
push:
branches:
- main
workflow_dispatch:

jobs:
push-image:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
with:
fetch-depth: 0

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Make gradlew executable
run: cd cors-bad | chmod +x ./gradlew
- name: Run build with Gradle Wrapper
run: cd cors-bad | ./gradlew :shadowJar

- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: 'Build Image'
run: |
docker build ./cors-bad -f ./cors-bad/Dockerfile --tag ghcr.io/matyrobbrt/file-preview/cors-bad:latest
docker push ghcr.io/matyrobbrt/file-preview/cors-bad:latest
3 changes: 3 additions & 0 deletions cors-bad/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM openjdk:17
COPY build/libs/cors-bad-all.jar /cors-bad.jar
ENTRYPOINT ["java", "-jar", "/cors-bad.jar"]
2 changes: 2 additions & 0 deletions cors-bad/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {
id 'com.github.johnrengelman.shadow' version '8.1.0'
}

java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))

group = 'com.matyrobbrt.corsbad'

application {
Expand Down
3 changes: 3 additions & 0 deletions cors-bad/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.+'
}

0 comments on commit 4b315a8

Please sign in to comment.