-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (35 loc) · 1.07 KB
/
push-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Push Image
on:
release:
types:
- published
jobs:
push_image:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-java@v4
with:
java-version-file: .java-version
distribution: temurin
- name: Build Image
run: ./gradlew --no-daemon dockerBuildNative
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Image
run: |
SHORT_IMAGE_NAME="$(cut -d/ -f2- <<< ${{ github.repository }}):latest"
IMAGE_NAME=ghcr.io/${{ github.repository }}
TAGGED_IMAGE_NAME="${IMAGE_NAME}:$(sed 's/^v//' <<< ${{ github.ref_name }})"
LATEST_IMAGE_NAME="${IMAGE_NAME}:latest"
for image in "$TAGGED_IMAGE_NAME" "$LATEST_IMAGE_NAME"; do
docker tag "$SHORT_IMAGE_NAME" "$image"
docker push "$image"
done