-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (91 loc) · 2.81 KB
/
release-draft.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
90
91
92
93
94
95
96
97
98
99
100
101
name: Release Drafter
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: write
id-token: "write"
env:
publish: ${{github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/dependabot')}}
jobs:
build-artifact:
name: "Build and run tests"
runs-on: ubuntu-latest
steps:
- run: |
echo ${{ github.ref }}
echo ${{ github.base_ref }}
echo ${{ github.head_ref }}
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Resolve/Update Dependencies
run: mvn -B -q -fae package dependency:resolve-plugins dependency:go-offline
- name: Build (and run tests)
run: mvn -B -q -fae clean install
- name: Save test results
run: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
update_release_draft_labels:
if: github.ref != 'refs/heads/main'
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update_release_draft:
needs: build-artifact
if: github.ref == 'refs/heads/main'
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setting version
id: set_version
run: |
export GIT_COMMIT_DATE=$(git log -1 --pretty='%ad' --date=format:'%Y.%m.%d.%H%M%S')
export VERSION=${GIT_COMMIT_DATE}
echo "VERSION=${GIT_COMMIT_DATE}" >> $GITHUB_ENV
echo "Setting version $VERSION"
- uses: release-drafter/release-drafter@v5
with:
version: ${{ env.VERSION }}
tag: ${{ env.VERSION }}
name: "Release ${{ env.VERSION }}"
publish: ${{ env.publish }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
version: ${{ env.VERSION }}
published: ${{ env.publish == true }}
publish:
needs: update_release_draft
if: ${{ needs.update_release_draft.outputs.published }}
permissions:
contents: "write"
id-token: "write"
packages: "write"
name: Publish package
uses: ./.github/workflows/publish_dispatcher.yaml
with:
version: ${{ needs.update_release_draft.outputs.version }}
secrets: inherit