-
-
Notifications
You must be signed in to change notification settings - Fork 4
110 lines (96 loc) · 3.38 KB
/
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
name: Release
on:
pull_request:
types: closed
jobs:
tag:
name: Create Tag
runs-on: ubuntu-latest
if: github.event.pull_request.merged && (github.base_ref == 'develop' || github.base_ref == 'master')
outputs:
tag: ${{ steps.calculate.outputs.next_tag }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/requirements.txt
- name: Get Latest Tag
id: latest_tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Calculate next tag
id: calculate
run: python tests/helpers/release.py ${{ steps.latest_tag.outputs.tag }} ${{ github.event.pull_request.number }} ${{ github.base_ref }}
- name: Create Tag
id: create_tag
uses: K-Phoen/semver-release-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_branch: ${{ github.base_ref }}
release_strategy: tag
tag_format: ${{ env.TAG_FORMAT }}
tag: ${{ steps.calculate.outputs.next_tag }}
publish:
name: Publish Package
runs-on: ubuntu-latest
needs: tag
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
- name: Publish Package
run: |
chmod +x gradlew
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_CICD_TAG: ${{needs.tag.outputs.tag}}
release:
name: Create Release
runs-on: ubuntu-latest
needs: [tag, publish]
steps:
- name: Create Draft Release
uses: release-drafter/release-drafter@v5.21.1
if: github.base_ref == 'develop'
with:
tag: ${{needs.tag.outputs.tag}}
version: ${{needs.tag.outputs.tag}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: release_info
uses: release-drafter/release-drafter@v5.21.1
if: github.base_ref == 'master'
with:
tag: ${{needs.tag.outputs.tag}}
version: ${{needs.tag.outputs.tag}}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tweet Release Info
id: tweet
if: github.base_ref == 'master'
uses: snow-actions/tweet@v1.1.1
env:
CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
CONSUMER_API_SECRET_KEY: ${{ secrets.TWITTER_CONSUMER_API_SECRET_KEY }}
ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
with:
status: |
Released ${{ steps.release_info.outputs.name }}
${{ steps.release_info.outputs.html_url }}
- name: Twitter response
if: github.base_ref == 'master'
run: echo ${{ steps.tweet.outputs.response }}