forked from devgateway/dg-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (111 loc) · 3.79 KB
/
release.yml
File metadata and controls
126 lines (111 loc) · 3.79 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Build and Release
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
packages: write
jobs:
prepare-a-release:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.tag_version.outputs.new_version }}
new_tag: ${{ steps.tag_version.outputs.new_tag }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Generate Tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: 'main,production,release/*'
tag_prefix: 'v'
dry_run: 'true'
build-and-push-docker-image:
needs: prepare-a-release
runs-on: ubuntu-latest
outputs:
new_version: ${{ needs.prepare-a-release.outputs.new_version }}
new_tag: ${{ needs.prepare-a-release.outputs.new_tag }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=${{ vars.DOCKER_REGISTRY }}/devgateway/data-viz/admin:buildcache
cache-to: type=registry,ref=${{ vars.DOCKER_REGISTRY }}/devgateway/data-viz/admin:buildcache,mode=max
context: .
push: true
build-args: |
VERSION=${{ needs.prepare-a-release.outputs.new_version }}
TAG=${{ needs.prepare-a-release.outputs.new_tag }}
GIT_BRANCH=${{ needs.prepare-a-release.outputs.new_tag }}
tags: |
${{ vars.DOCKER_REGISTRY }}/devgateway/data-viz/admin:latest
${{ vars.DOCKER_REGISTRY }}/devgateway/data-viz/admin:v${{ needs.prepare-a-release.outputs.new_version }}
release-on-github:
needs: build-and-push-docker-image
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
cache: 'maven'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: |
~/.m2/repository
!~/.m2/repository/org/devgateway/tcdi
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build the Maven project
run: |
mvn package -DskipTests=true -Dcheckstyle.skip \
&& mkdir -p forms/target/deps \
&& cd forms/target/deps \
&& jar -xf ../*.jar
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: changelog
with:
config: cliff.toml
args: '--unreleased'
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build-and-push-docker-image.outputs.new_tag }}
files: forms/target/*.jar
body_path: CHANGELOG.md
draft: false
prerelease: false
make_latest: 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}