-
Notifications
You must be signed in to change notification settings - Fork 9
45 lines (41 loc) · 1.17 KB
/
release-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
42
43
44
name: Publish master
on:
release:
types: [published]
permissions:
packages: write
env:
IMAGE: ghcr.io/${{ github.repository }}
NEW_VERSION: ${{ github.event.release.tag_name }}
jobs:
build:
name: Build and publish docker image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: 'master'
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
architecture: x64
cache: 'gradle'
- name: Build gradle artifacts
shell: bash
run: |
./gradlew shadowJar
env:
ORG_GRADLE_PROJECT_githubUser: x-access-token
ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker images
run: |
docker build --tag ${{ env.IMAGE }}:${{ env.NEW_VERSION }} .
- name: Push docker image to GitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
docker push ${{ env.IMAGE }}:${{ env.NEW_VERSION }}