Skip to content

Commit

Permalink
Merge pull request #44 from atlassian-labs/nlam/release-version-1.1.2
Browse files Browse the repository at this point in the history
Release version 1.1.2
  • Loading branch information
nlam-atlassian authored Oct 20, 2024
2 parents 47b1fcf + b9f484f commit 9886c3a
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 13 deletions.
217 changes: 209 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,63 @@
name: Publish to artifactory on release branch
name: Publish for Android and iOS on release branch

on:
push:
branches: [ "release" ]
workflow_dispatch:

jobs:
build:
runs-on: macos-latest

permissions:
contents: read
contents: write
id-token: write
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}

steps:

- name: "Checkout sources"
uses: actions/checkout@v4

- name: "Setup Java"
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

- name: "Checkout sources"
uses: actions/checkout@v4

# Read the version from the version.properties file
- name: Get version for creating release
uses: kurt-code/[email protected]
id: read-properties
with:
operation: 'read'
file-path: 'version.properties'
keys: 'projectVersion'

# Tags the current commit with the version number
- name: Create tag
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.read-properties.outputs.projectVersion }}',
sha: context.sha
})
# Create GitHub release using the tag
- name: release
uses: actions/create-release@v1
id: create_release
with:
release_name: ${{ steps.version.outputs.version }}
tag_name: ${{ steps.read-properties.outputs.projectVersion }}
body: "Release ${{ steps.read-properties.outputs.projectVersion }}"
env:
GITHUB_TOKEN: ${{ github.token }}

# Populates ARTIFACTORY_USERNAME and ARTIFACTORY_API_KEY with
# temporary username/password for publishing to packages.atlassian.com
- name: Get publish token
Expand All @@ -33,6 +66,174 @@ jobs:
with:
output-modes: environment

# Publishes to Artifactory only when a tag is pushed
- name: "Publish"
# Android: Publishes to Artifactory
- name: "Publish to artifactory"
run: ./gradlew assemble --no-configuration-cache && ./gradlew publish --no-configuration-cache --stacktrace

# iOS: Build and publish xcframeworks to the GitHub release
- name: "Build xcframework"
run: ./gradlew assembleXCFramework

- name: "Release data:"
run: echo id ${{steps.create_release.outputs.id}} html_url ${{steps.create_release.outputs.html_url}} upload_url ${{steps.create_release.outputs.upload_url}}

- name: "Prepare xcframework artifacts for collab module"
run: bash ${GITHUB_WORKSPACE}/gradle/pack_xcframework.sh collab ${{steps.create_release.outputs.html_url}}

- name: "Prepare xcframework artifacts for history module"
run: bash ${GITHUB_WORKSPACE}/gradle/pack_xcframework.sh history ${{steps.create_release.outputs.html_url}}

- name: "Prepare xcframework artifacts for model module"
run: bash ${GITHUB_WORKSPACE}/gradle/pack_xcframework.sh model ${{steps.create_release.outputs.html_url}}

- name: "Prepare xcframework artifacts for state module"
run: bash ${GITHUB_WORKSPACE}/gradle/pack_xcframework.sh state ${{steps.create_release.outputs.html_url}}

- name: "Prepare xcframework artifacts for test-builder module"
run: bash ${GITHUB_WORKSPACE}/gradle/pack_xcframework.sh test-builder ${{steps.create_release.outputs.html_url}}

- name: "Prepare xcframework artifacts for transform module"
run: bash ${GITHUB_WORKSPACE}/gradle/pack_xcframework.sh transform ${{steps.create_release.outputs.html_url}}

- name: "Prepare xcframework artifacts for util module"
run: bash ${GITHUB_WORKSPACE}/gradle/pack_xcframework.sh util ${{steps.create_release.outputs.html_url}}

- name: upload xcframework artifacts for collab module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./collab/build/collab.xcframework.zip
asset_name: collab.xcframework.zip
asset_content_type: application/zip

- name: upload Package.swift artifacts for collab module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./collab/build/Package.swift
asset_name: collab.package.swift
asset_content_type: text/plain

- name: upload xcframework artifacts for history module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./history/build/history.xcframework.zip
asset_name: history.xcframework.zip
asset_content_type: application/zip

- name: upload Package.swift artifacts for history module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./history/build/Package.swift
asset_name: history.package.swift
asset_content_type: text/plain

- name: upload xcframework artifacts for model module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./model/build/model.xcframework.zip
asset_name: model.xcframework.zip
asset_content_type: application/zip

- name: upload Package.swift artifacts for model module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./model/build/Package.swift
asset_name: model.package.swift
asset_content_type: text/plain

- name: upload xcframework artifacts for state module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./state/build/state.xcframework.zip
asset_name: state.xcframework.zip
asset_content_type: application/zip

- name: upload Package.swift artifacts for state module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./state/build/Package.swift
asset_name: state.package.swift
asset_content_type: text/plain

- name: upload xcframework artifacts for test-builder module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./test-builder/build/test_builder.xcframework.zip
asset_name: test-builder.xcframework.zip
asset_content_type: application/zip

- name: upload Package.swift artifacts for test-builder module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./test-builder/build/Package.swift
asset_name: test-builder.package.swift
asset_content_type: text/plain

- name: upload xcframework artifacts for transform module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./transform/build/transform.xcframework.zip
asset_name: transform.xcframework.zip
asset_content_type: application/zip

- name: upload Package.swift artifacts for transform module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./transform/build/Package.swift
asset_name: transform.package.swift
asset_content_type: text/plain

- name: upload xcframework artifacts for util module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./util/build/util.xcframework.zip
asset_name: util.xcframework.zip
asset_content_type: application/zip

- name: upload Package.swift artifacts for util module
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./util/build/Package.swift
asset_name: util.package.swift
asset_content_type: text/plain
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ Prior to accepting your contributions we ask that you please follow the appropri

## Releases
To create a release, follow these steps:
1. Update the version in the `build.gradle.kts` file.
1. Update the version in the `version.properties` file.
2. Create a PR with these changes, targeting the `main` branch.
3. Once the PR is merged, create a PR to merge `main` into `release` branch.
4. Once the 2nd PR is merged, the CI/CD pipeline will create a release, upload iOS assets and publish Android binaries to Artifactory.
5. Create a new tag with the format `v*` (e.g. `v1.1.0`) on the `release` branch.
4. Once the release is created, edit the release in the Github UI to add release notes for this release (using `Generate release notes`).
4. Once the 2nd PR is merged, the CI/CD pipeline will:
1. Tag the commit with the new version.
2. Create a Github release.
3. Publish Android binaries to Artifactory.
4. Upload iOS assets to the Github release.
5. Edit the release in the Github UI to add release notes for this release (using `Generate release notes`).
8 changes: 7 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import java.io.FileInputStream
import java.util.Properties

plugins {
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.kotlin.jvm)
Expand All @@ -19,9 +22,12 @@ dependencies {
implementation(libs.kotlin.stdlib)
}

val versionProperties = Properties()
versionProperties.load(FileInputStream("version.properties"))

allprojects {
group = "com.atlassian.prosemirror"
version = "1.1.1"
version = versionProperties.get("projectVersion") as String
}

val javaVersion = JavaVersion.VERSION_17
Expand Down
1 change: 1 addition & 0 deletions version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
projectVersion=1.1.2

0 comments on commit 9886c3a

Please sign in to comment.