-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (73 loc) · 2.51 KB
/
release.yaml
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
name: Release
on:
workflow_dispatch:
push:
branches:
- main
- develop
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
JAVA_VERSION: '21'
REGISTRY: ghcr.io
IMAGE_NAME: nicholasm95/api-skoda
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'liberica'
cache: 'maven'
- name: Setup Node.js environment
uses: actions/setup-node@v4.0.2
with:
node-version: 20
- name: Install Semantic Release and plugins
run: |
npm install semantic-release @semantic-release/exec @semantic-release/changelog @semantic-release/github
- name: Log in to the Container registry
uses: docker/login-action@70fccc794acd729b2b22dd6a326895f286447728
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate next version
run: |
npx semantic-release --dry-run --no-ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SKIP_UPDATE_VERSION_IN_POM: true
- name: Build with Maven Wrapper
run: ./mvnw install
- name: Create Docker image
run: ./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(cat .image_tag) -DskipTests
- name: Docker push
run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(cat .image_tag)
- name: Create Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update CHANGELOG.md
if: github.ref == 'refs/heads/main'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add CHANGELOG.md
git commit -m "docs(CHANGELOG): Update CHANGELOG.md"
git push origin main
- name: Update develop branch
if: github.ref == 'refs/heads/main'
run: |
git fetch origin
git checkout develop
git merge --ff-only origin/main
git push origin develop