-
-
Notifications
You must be signed in to change notification settings - Fork 15
52 lines (49 loc) · 1.54 KB
/
deploy.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
45
46
47
48
49
50
51
52
name: "deploy"
on:
push:
branches: ["main"]
concurrency:
cancel-in-progress: true
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
jobs:
deploy:
runs-on: "ubuntu-latest"
outputs:
image-json: "${{ steps.publish.outputs.imageJson }}" # output produced from printJibMeta Gradle task
steps:
- name: "checkout"
uses: "actions/checkout@v4"
- name: "setup java"
uses: "actions/setup-java@v4"
with:
distribution: "zulu"
java-version: "17"
- name: "check"
run: ./gradlew check
- name: "login"
uses: "docker/login-action@v3"
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: "publish"
id: publish
run: "./gradlew jib -Djib.console=plain"
promote:
needs: "deploy"
runs-on: "ubuntu-latest"
environment: "promoted"
steps:
- name: "login"
uses: "docker/login-action@v3"
with:
registry: "ghcr.io"
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: "tag"
env:
IMAGE_ID: "${{ fromJSON(needs.deploy.outputs.image-json).imageId }}"
IMAGE_NAME: "${{ fromJSON(needs.deploy.outputs.image-json).image }}"
PROMOTED_TAG_NAME: "stable"
run: |
skopeo copy -a "docker://$IMAGE_NAME@$IMAGE_ID" "docker://$IMAGE_NAME:$PROMOTED_TAG_NAME"