-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (115 loc) · 4.73 KB
/
deploy-release.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Release new version
on:
workflow_dispatch:
inputs:
semverBump:
description: 'The type of Semantic Version bump (patch, minor or major)'
required: true
default: 'patch'
jobs:
deploy-release:
runs-on: ubuntu-latest
permissions:
packages: write
pull-requests: write
contents: write
repository-projects: write
strategy:
matrix:
repo: [ 'standard-api/axon-driver' ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup JDK with maven
uses: ./.github/actions/setup-jdk-with-maven
- name: Bump new Semantic Version in maven
uses: ./.github/actions/bump-maven-version
id: bumpedVersion
with:
bump: ${{ github.event.inputs.semverBump }}
- name: Set git user and email
uses: ./.github/actions/set-git-username
- name: Create release commit for maven
uses: ./.github/actions/create-release-commit-maven
with:
bump: ${{ github.event.inputs.semverBump }}
version: ${{ steps.bumpedVersion.outputs.version }}
- name: Create release commit using PR and automatic merge
if: ${{ steps.bumpedVersion.outputs.was_bumped == 'true' }}
uses: ./.github/actions/create-release-pr-and-merge
with:
github_token: ${{ secrets.GH_STAPI_BOT_TOKEN }}
bump: ${{ github.event.inputs.semverBump }}
version: ${{ steps.bumpedVersion.outputs.version }}
repository: core
- name: Checkout updated master
uses: actions/checkout@v3
with:
ref: master
- name: Check if version exists on Sonatype
uses: ./.github/actions/check-sonatype-version
id: check_version
with:
group_id: 'ai.stapi'
artifact_id: 'core'
version: ${{ steps.bumpedVersion.outputs.version }}
- name: Setup JDK for sonatype release
uses: ./.github/actions/setup-jdk-for-sonatype-release
with:
ossrh_gpg_secret_key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
- name: Deploy release to Sonatype
if: ${{ steps.check_version.outputs.version_exists == 'false' }}
uses: ./.github/actions/deploy-sonatype-all-in-order
with:
ossrh_username: ${{ secrets.OSSRH_USERNAME }}
ossrh_token: ${{ secrets.OSSRH_TOKEN }}
ossrh_gpg_secret_key_password: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
- name: Tag the release idempotently
run: |
if ! git ls-remote --tags origin | grep ${{ steps.bumpedVersion.outputs.version }} >/dev/null; then
git tag ${{ steps.bumpedVersion.outputs.version }}
git push origin ${{ steps.bumpedVersion.outputs.version }}
fi
- name: Check if release exists
id: check_release
uses: ./.github/actions/check-github-release-exists
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.bumpedVersion.outputs.version }}
- name: Publish release on github
id: publish_release_github
if: steps.check_release.outputs.exists == 'false'
uses: ./.github/actions/publish-release-github
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_version: ${{ steps.bumpedVersion.outputs.version }}
- name: Publish release notifications
if: steps.check_release.outputs.exists == 'false'
uses: ./.github/actions/publish-release-notifications
with:
discord_webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
release_version: ${{ steps.bumpedVersion.outputs.version }}
repository: "standard-api/core"
changelog: ${{ steps.publish_release_github.outputs.changelog }}
- name: Set next SNAPSHOT version
uses: ./.github/actions/bump-maven-version
id: bumpedVersionSnapshot
with:
bump: 'snapshot'
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GH_STAPI_BOT_TOKEN }}
repository: ${{ matrix.repo }}
event-type: stapi-core-released
client-payload: '{"new_version": "${{ steps.bumpedVersion.outputs.version }}","new_snapshot_version": "${{ steps.bumpedVersionSnapshot.outputs.version }}","bumpType": "${{ github.event.inputs.semverBump }}"}'
- name: Create snapshot commit using PR and automatic merge
uses: ./.github/actions/create-snapshot-commit
with:
github_token: ${{ secrets.GH_STAPI_BOT_TOKEN }}
version: ${{ steps.bumpedVersionSnapshot.outputs.version }}
repository: 'core'
- name: Checkout updated master
uses: actions/checkout@v3
with:
ref: master