This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (79 loc) · 2.55 KB
/
main.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
name: Main Handler
on:
push:
branches:
- main
workflow_dispatch:
jobs:
release:
name: Auto release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.changelog.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
fetch-depth: 0
- uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-test-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-test-
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Conventional Changelog Update
uses: TriPSs/conventional-changelog-action@v5
id: changelog
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
output-file: 'CHANGELOG.md'
skip-version-file: 'true'
skip-commit: 'true'
git-push: 'false'
skip-on-empty: 'false'
- name: Set new version
run: |
echo "::set-output name=version::${{ steps.changelog.outputs.version }}"
mvn versions:set -DnewVersion='${{ steps.changelog.outputs.version }}' -f pom.xml -DskipTests
- name: Update POM
run: mvn versions:commit --file pom.xml
- name: Commit pom and changelog
uses: EndBug/add-and-commit@v9
with:
author_name: Ci Bot
author_email: [email protected]
message: 'doc: updating pom to ${{ steps.changelog.outputs.version }} [ci skip]'
add: '["pom.xml","CHANGELOG.md"]'
- name: Create Release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.changelog.outputs.tag }}
name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
docker:
name: Deploy to Docker
needs:
- release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: rmcampos/fast-jobs:latest, rmcampos/fast-jobs:${{ needs.release.outputs.version }}