Add empty line #91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |