-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (100 loc) · 3.05 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
name: Create release
on:
push:
tags:
- 'v*'
branches:
- main
env:
GPG_SEC: ${{ secrets.PGP_SEC }}
GPG_PASSWORD: ${{ secrets.PGP_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }}
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
jobs:
release:
name: Build release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# release workflow should have access to all tags
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
- name: Status git before
run: git status
- name: gradle release from tag
# if workflow is triggered after push of a tag, deploy full release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: |
linkReleaseExecutableMultiplatform
publishToSonatype
closeSonatypeStagingRepository
-Prelease
--build-cache
-PgprUser=${{ github.actor }}
-PgprKey=${{ secrets.GITHUB_TOKEN }}
- name: gradle snapshot from branch
# if workflow is triggered after push to a branch, deploy snapshot
if: ${{ startsWith(github.ref, 'refs/heads/') }}
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: |
linkReleaseExecutableMultiplatform
publishToSonatype
-Preckon.stage=snapshot
-Prelease
--build-cache
-PgprUser=${{ github.actor }}
-PgprKey=${{ secrets.GITHUB_TOKEN }}
- name: Status git after
if: ${{ always() }}
run: git status
- name: Upload artifact
id: upload_artifact
uses: actions/upload-artifact@v4
with:
name: save-cli-${{ runner.os }}
path: save-cli/build/bin/**/releaseExecutable/*
retention-days: 1
github_release:
needs: release
# release is created only for tags
if: ${{ startsWith(github.ref, 'refs/tags/') }}
name: Create Github Release
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
path: tmpFolder
- name: Create Github Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload save-cli
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tmpFolder/**/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true