-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (139 loc) · 5.57 KB
/
maven-artifact-alpha.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Publish common dev Artifacts to GitHub packages
on:
push:
branches:
- 'main'
tags-ignore:
- '**'
permissions:
contents: write
packages: write
env:
ORG_GRADLE_PROJECT_HEDVIG_GITHUB_PACKAGES_USER: ${{ secrets.HEDVIG_GITHUB_PACKAGES_USER }}
ORG_GRADLE_PROJECT_HEDVIG_GITHUB_PACKAGES_TOKEN: ${{ secrets.HEDVIG_GITHUB_PACKAGES_TOKEN }}
jobs:
publish-spm:
concurrency: "kmmbridgepublish-${{ github.repository }}"
runs-on: macos-12
steps:
- name: Checkout the repo with tags
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
- name: Generate alpha version timestamp
id: time
uses: nanzm/[email protected]
with:
timeZone: UTC
format: 'YYYYMMDDHHmmss'
- uses: touchlab/read-property@main
id: versionprop
with:
file: ./gradle.properties
property: AUTHLIB_VERSION_NAME
- name: Print tag to be generated and save into env
env:
ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}"
run: |
echo "Timestamp: $ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP"
- name: Generate SPM version
id: generateSPMversion
env:
SPM_VERSION: "${{ steps.versionprop.outputs.propVal }}${{ steps.time.outputs.time }}"
run: |
spmWithoutAlpha=$(echo "${{ steps.versionprop.outputs.propVal }}" | sed 's/-alpha//')
echo "::set-output name=SPM_VERSION::${spmWithoutAlpha}${{ steps.time.outputs.time }}"
- name: Build
id: gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: false
gradle-home-cache-cleanup: true
env:
ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}"
- name: Print next SPM version
run: |
echo "${{ steps.generateSPMversion.outputs.SPM_VERSION }}"
- uses: touchlab/autoversion-tagmarker@main
id: autoversion-tagmarker
with:
nextVersion: ${{ steps.generateSPMversion.outputs.SPM_VERSION }}
- uses: touchlab/autoversion-buildbranch@main
id: autoversion-buildbranch
with:
buildBranch: "build-${{ steps.generateSPMversion.outputs.SPM_VERSION }}"
# - uses: extractions/netrc@v1
# with:
# machine: ${{ inputs.netrcMachine }}
# username: ${{ secrets.netrcUsername != '' && secrets.netrcUsername || 'cirunner' }}
# password: ${{ secrets.netrcPassword != '' && secrets.netrcPassword || secrets.GITHUB_TOKEN }}
- name: Build Main
run: ./gradlew kmmBridgePublish -PENABLE_PUBLISHING=true -PGITHUB_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }} -PGITHUB_REPO=${{ github.repository }} --no-daemon --stacktrace
env:
GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m"
ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}"
- uses: touchlab/autoversion-finishrelease@main
id: autoversion-finishrelease
with:
commitMessage: "KMM SPM package release for ${{ steps.generateSPMversion.outputs.SPM_VERSION }}"
tagMessage: "KMM release version ${{ steps.generateSPMversion.outputs.SPM_VERSION }}"
tagVersion: ${{ steps.generateSPMversion.outputs.SPM_VERSION }}
branchName: "build-${{ steps.generateSPMversion.outputs.SPM_VERSION }}"
- uses: touchlab/autoversion-tagmarker@main
id: autoversion-tagmarker-cleanup
with:
nextVersion: ${{ steps.generateSPMversion.outputs.SPM_VERSION }}
cleanupMarkers: 'true'
- name: Delete branch
if: (!inputs.retainBuildBranch) && (!cancelled())
uses: touchlab/action-delete-branch@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: "build-${{ steps.generateSPMversion.outputs.SPM_VERSION }}"
publish-maven:
name: Release build and publish
runs-on: macos-12
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: false
gradle-home-cache-cleanup: true
- name: Generate alpha version timestamp
id: time
uses: nanzm/[email protected]
with:
timeZone: UTC
format: 'YYYY-MM-DD-HH-mm-ss'
- name: Print tag to be generated and save into env
env:
ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}"
run: |
echo "Timestamp: $ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP"
- name: Build
id: gradle
uses: gradle/[email protected]
env:
ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}"
# Maybe consider deleting old artifacts here
# - name: Delete old SNAPSHOT
# uses: actions/[email protected]
# with:
# package-name:
- name: Publish to GitHub packages
run: ./gradlew publishAllPublicationsToMavenRepository
env:
ORG_GRADLE_PROJECT_AUTHLIB_VERSION_ALPHA_TIMESTAMP: "${{ steps.time.outputs.time }}"