Skip to content

Commit 052478e

Browse files
committed
#47 Migrate docker registry to ghcr.io
1 parent d339b10 commit 052478e

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
path: ~/.gradle/caches
2626
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
2727
restore-keys: ${{ runner.os }}-gradle
28+
2829
- name: Build and analyze
2930
env:
3031
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
@@ -33,30 +34,13 @@ jobs:
3334
- uses: actions/upload-artifact@v2
3435
with:
3536
path: build/libs/*.jar
36-
deploy:
37-
runs-on: ubuntu-latest
38-
needs: build
39-
steps:
40-
- uses: actions/checkout@v2
41-
- uses: actions/setup-java@v1
42-
with:
43-
java-version: 11
44-
- name: Cache Gradle packages
45-
uses: actions/cache@v1
46-
with:
47-
path: ~/.gradle/caches
48-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
49-
restore-keys: ${{ runner.os }}-gradle
37+
5038
- uses: docker/login-action@v1
5139
with:
52-
username: raeperd
53-
password: ${{ secrets.DOCKERHUB_TOKEN }}
54-
- name: Get branch name (merge)
55-
if: github.event_name != 'pull_request'
56-
shell: bash
57-
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
58-
- name: Get branch name (pull request)
59-
if: github.event_name == 'pull_request'
60-
shell: bash
61-
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
62-
- run: ./gradlew jib -Djib.to.tags=${{ env.BRANCH_NAME }}
40+
registry: ghcr.io/raeperd
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
- name: Get branch name
44+
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr /# -)" >> $GITHUB_ENV
45+
- name: Build container image
46+
run: ./gradlew jib -Djib.to.tags=${{ env.BRANCH_NAME }}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jib {
5858
}
5959
}
6060
to {
61-
image = "raeperd/realworld-spring-boot-java"
61+
image = "ghcr.io/raeperd/${rootProject.name}"
6262
}
6363
container {
6464
ports = ["8080"]

0 commit comments

Comments
 (0)