forked from avisi-cloud/structurizr-site-generatr
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (81 loc) · 2.59 KB
/
pr.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: pr
on:
pull_request:
branches:
- main
push:
branches:
- main
env:
VERSION: '0.0.1'
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-gradle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 19
- name: Setup Gradle
uses: gradle/[email protected]
- name: Execute Gradle build
run: ./gradlew test installDist
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: binaries
path: build/install
retention-days: 1
build-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
needs: build-gradle
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: binaries
path: build/install
- name: Build container image
uses: docker/build-push-action@v4
with:
push: ${{ github.event_name != 'pull_request' }}
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# tags: |
# ghcr.io/avisi-cloud/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
# ghcr.io/avisi-cloud/${{ env.IMAGE_NAME }}:latest
# labels: |
# org.opencontainers.image.title=${{ github.event.repository.name }}
# org.opencontainers.image.description=${{ github.event.repository.description }}
# org.opencontainers.image.url=${{ github.event.repository.html_url }}
# org.opencontainers.image.revision=${{ github.sha }}
# org.opencontainers.image.version=${{ env.VERSION }}