-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (82 loc) · 2.72 KB
/
prepare-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
name: Prepare Release
on:
pull_request:
env:
NEXUS_SDK_REF: release-publishing
NEXUS_SDK_TAG: v0.1.0-alpha1
# workflow_dispatch:
# inputs:
# tag:
# type: string
# description: "Release version tag (e.g. v1.2.3)"
# required: true
# ref:
# type: string
# description: "Git ref from which to release"
# required: true
# default: "main"
# do_publish_jars:
# type: boolean
# description: "Publish Java artifacts for staging"
# required: true
# default: "true"
# env:
# NEXUS_SDK_REF: ${{ github.event.inputs.ref }}
# NEXUS_SDK_TAG: ${{ github.event.inputs.tag }}
jobs:
create_draft_release:
name: Create Github draft release
runs-on: ubuntu-latest
steps:
- name: Audit gh version
run: gh --version
- name: Check for existing release
id: check_release
run: |
echo "::echo::on"
gh release view --repo "$GITHUB_REPOSITORY" "$NEXUS_SDK_TAG" \
&& echo "::set-output name=already_exists::true" \
|| echo "::set-output name=already_exists::false"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repo
if: steps.check_release.outputs.already_exists == 'false'
uses: actions/checkout@v4
with:
ref: ${{ env.NEXUS_SDK_REF }}
- name: Create release
if: steps.check_release.outputs.already_exists == 'false'
run: >
gh release create
"$NEXUS_SDK_REF"
--draft
--repo "$GITHUB_REPOSITORY"
--title "$NEXUS_SDK_TAG"
--target "$NEXUS_SDK_REF"
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_java_artifacts:
name: Publish Java artifacts
# if: ${{ github.event.inputs.do_publish_jars == 'true' }}
runs-on: ubuntu-latest
needs: create_draft_release
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ env.NEXUS_SDK_REF }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "temurin"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Stage
run: ./gradlew nexus-sdk:publishToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }}