-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (89 loc) · 2.96 KB
/
createRelease.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Create release and tag
on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
release-type: # id of input
description: "prerelease, patch, minor or major"
required: true
default: "prerelease"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
release-type: ${{ github.event.inputs.release-type }}
jobs:
build:
name: "Creating changelog and release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: generate tag and release body
run: |
RELEASE_TYPE=$(sh ${{ github.workspace }}/.github/workflows/getReleaseType.sh ${{ env.release-type }})
git config user.name github-ljprojectbuilder
git config user.email [email protected]
npx standard-version -i CHANGELOG.md --release-as $RELEASE_TYPE
- name: Read CHANGELOG.md
id: package
uses: juliangruber/read-file-action@v1
with:
path: ./CHANGELOG.md
- name: Echo CHANGELOG.md
run: echo '${{ steps.package.outputs.content }}'
- name: publish tag
id: publish_tag
run: |
git push --follow-tags
echo ::set-output name=tag_name::$(git describe HEAD --abbrev=0)
- name: create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: Release ${{ steps.publish_tag.outputs.tag_name }}
tag_name: ${{ steps.publish_tag.outputs.tag_name }}
body_path: CHANGELOG.md
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 17
- name: npm install
run: |
if [ -d "webclient/app" ]; then
cd webclient/app
npm install --legacy-peer-deps
fi
- name: Build with Maven
run: mvn -B package -P frontend --file pom.xml
env:
CI: false
- name: Upload Maven build artifact
uses: actions/upload-artifact@v1
with:
name: artifact
path: application/target/application-0.0.1-SNAPSHOT.jar
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.publish_tag.outputs.tag_name }}
- name: Build docker image with tag version and push to dockerhub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: starwitorg/ljprojectbuilder
tags: ${{ steps.publish_tag.outputs.tag_name }}
path: .
dockerfile: ./Dockerfile