Skip to content

Commit 78455fc

Browse files
authored
Simplify the release flow (#6587)
* update release flow * keep generating the documentation, we need it for GitHub pages
1 parent 0c14f33 commit 78455fc

File tree

7 files changed

+186
-361
lines changed

7 files changed

+186
-361
lines changed

.github/workflows/push.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
gradle-home-cache-cleanup: true
2525
- name: Build with Gradle
2626
run: |
27+
./gradlew :apollo-kdoc:dokkaGeneratePublicationHtml
2728
./gradlew nmcpPublishAggregationToCentralPortalSnapshots
2829
env:
2930
LIBRARIAN_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

.github/workflows/tag.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
#--no-configuration-cache for https://youtrack.jetbrains.com/issue/KT-65879
2525
- name: Publish to Maven Central
2626
run: |
27-
./gradlew nmcpPublishAggregationToCentralPortal
27+
LIBRARIAN_RELEASE=true ./gradlew nmcpPublishAggregationToCentralPortal
2828
env:
2929
LIBRARIAN_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
3030
LIBRARIAN_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

CONTRIBUTING.md

Lines changed: 17 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ The Apollo team welcomes contributions of all kinds, including bug reports, docu
44
features.
55

66
If you want to discuss the project or just say hi, stop
7-
by [the kotlinlang Slack channel](https://app.slack.com/client/T09229ZC6/C01A6KM1SBZ)(get your
8-
invite [here](https://slack.kotl.in/))
7+
by [the kotlinlang Slack channel](https://app.slack.com/client/T09229ZC6/C01A6KM1SBZ) (get your
8+
invite [here](https://slack.kotl.in/)).
99

1010
## Project Setup
1111

@@ -198,53 +198,31 @@ features of Kotlin/Coroutines/etc. and therefore may break in certain situations
198198

199199
## Releasing
200200

201-
Releasing is done using Github Actions. The CI contains credentials to upload artifacts to Sonatype and the Gradle
202-
Plugin Portal.
203-
204-
Snapshots are published automatically.
205-
Releases are published when a tag is pushed.
206-
207-
Here are the steps to do a new release:
208-
209-
* `git checkout main && git pull`
210-
* `scripts/release.main.kts <version-name>`
211-
* while it compiles, prepare the changelog, open a PR to `CHANGELOG.md` (see below)
212-
* wait for the CI to finish compiling
213-
* go to https://s01.oss.sonatype.org/, and release the artifacts manually. This step is called "close, release and drop"
214-
in the Sonatype ecosystem.
215-
* wait for it to be visible on [Maven Central](https://repo1.maven.org/maven2/com/apollographql/apollo/) (this usually
216-
takes a few minutes). If you're on MacOS, you can
217-
use [dependency-watch](https://github.com/JakeWharton/dependency-watch): `dependency-watch await 'com.apollographql.apollo:apollo-runtime:$version' && osascript -e 'display notification "Release is ready 🚀"'`
218-
* merge pending documentation/tutorial updates. Make sure the tutorial compiles and runs well.
219-
* paste the changelog in a new release on [GitHub](https://github.com/apollographql/apollo-kotlin/releases)
201+
Releasing is done using Github Actions.
202+
The CI contains credentials to upload artifacts to Maven Central, snapshots and Google Cloud preview repos.
203+
204+
The version in source control always ends with `-SNAPSHOT`. When a tag is built, the `-SNAPSHOT` suffix is dropped.
205+
206+
To create a version:
207+
* Go to https://github.com/apollographql/apollo-kotlin/releases/new
208+
* Enter the new tag name in the "Choose a tag" dropdown. That tag name must match the current version without `-SNAPSHOT` and be prefixed by `v`: `vX.Y.Z`.
209+
* Enter the changelog.
210+
* Hit "publish release".
211+
* The release job will be triggered and the artifacts will be uploaded to Maven Central when done (might take several minutes to a couple of hours).
212+
* Update docs and prepare next release by calling `./scripts/update-repo --prepare-next-version`
220213
* if it's a significant release, tweet about it 🐦
221214
* relax 🍹
222215

216+
If you need to bump the version more than one minor:
217+
* call `./scripts/update-repo --set-version x.y.z-SNAPSHOT`. This makes sure that the version is updated everywhere it needs be but doesn't change the docs. The version must always end with `-SNAPSHOT`.
218+
223219
### Changelog file
224220
* Add a section with the version, date, and a quick summary of what the release contains.
225221
* Optionally add a few sections to zoom in on changes you want to highlight.
226222
* No need to highlight deprecations, as warnings in the code are enough.
227223
* Mention and thank external contributors if any.
228224
* Add an "All changes" section that should list all commits since last release (can use `git log --pretty=oneline <previous-tag>..main`). Commits on the documentation can be omitted.
229225

230-
## Debugging minimized Gradle Plugin stacktraces
231-
232-
Because the Gradle plugin uses [R8](https://r8.googlesource.com/r8) to relocate dependencies, the stacktraces do not
233-
match the source code by default. It is possible to retrace them using the mapping file and R8.
234-
235-
Indicative steps (replace values accordingly below):
236-
237-
```
238-
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
239-
export PATH=/path/to/depot_tools:$PATH
240-
git clone https://r8.googlesource.com/r8
241-
cd r8
242-
./tools/gradle.py d8 r8
243-
wget https://repo.maven.apache.org/maven2/com/apollographql/apollo3/apollo-gradle-plugin/3.3.1/apollo-gradle-plugin-3.3.1-mapping.txt
244-
java -cp build/libs/r8_with_deps.jar com.android.tools.r8.retrace.Retrace apollo-gradle-plugin-3.3.1-mapping.txt
245-
[copy paste your stacktrace and press Crtl-D to launch the retracing]
246-
```
247-
248226
## Tests
249227

250228
You can run tests with `./gradlew build`.
@@ -260,50 +238,3 @@ where:
260238
* We need to test a specific version of Gradle and/or KGP, AGP or another buildscript dependency.
261239
* We need to tweak the Gradle environment, for an example, a server needs to run in the background.
262240
* We need to test up-to-date checks, build cache or other things that require instrumenting the build outcome.
263-
264-
## Overview of the CI
265-
266-
The project uses [GitHub Actions](https://docs.github.com/en/actions) to automate the build process.
267-
268-
We have [3 workflows](https://github.com/apollographql/apollo-kotlin/tree/main/.github/workflows), triggered by the
269-
following events:
270-
271-
### On PRs
272-
273-
**Workflow:** [`pr.yml`](https://github.com/apollographql/apollo-kotlin/blob/main/.github/workflows/pr.yml)
274-
275-
**Jobs (run in parallel):**
276-
277-
- `tests-gradle`
278-
- Slow gradle tests
279-
- `tests-no-gradle`
280-
- All root tests but not the Gradle ones and not the "exotic" apple ones (tvos, watchos)
281-
- All apiCheck
282-
- `tests-integration`
283-
- All integration tests (except Java 9+ ones)
284-
- `intellij-plugin`
285-
- IntelliJ plugin build and tests
286-
287-
### On pushes to `main` branch
288-
289-
**Workflow:** [`push.yml`](https://github.com/apollographql/apollo-kotlin/blob/main/.github/workflows/push.yml)
290-
291-
**Job:**
292-
293-
- `deploy`
294-
- Runs on macOS
295-
- Slow
296-
- Run all tests
297-
- Publish Snapshot to Sonatype
298-
- Publish KDoc
299-
300-
### On new tags
301-
302-
**Workflow:** [`tag.yml`](https://github.com/apollographql/apollo-kotlin/blob/main/.github/workflows/tag.yml)
303-
304-
**Job:**
305-
306-
- `publish-libraries`
307-
- Publish libraries to Maven Central
308-
- `publish-intellij-plugin`
309-
- Publish IntelliJ plugin to Jetbrains Marketplace

build-logic/src/main/kotlin/Publishing.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,12 @@ private fun Project.configureModulePublishingInternal() {
342342
*/
343343
private fun Project.setDefaultPomFields(mavenPublication: MavenPublication) {
344344
mavenPublication.groupId = findProperty("GROUP") as String?
345-
mavenPublication.version = findProperty("VERSION_NAME") as String?
345+
var version = (findProperty("VERSION_NAME") as String?) ?: error("cannot find property 'VERSION_NAME'")
346+
if (System.getenv("LIBRARIAN_RELEASE") == "true") {
347+
// This is a release, drop the -SNAPSHOT
348+
version = version.replace("-SNAPSHOT", "")
349+
}
350+
mavenPublication.version = version
346351

347352
mavenPublication.pom {
348353
name.set(findProperty("POM_NAME") as String?)

0 commit comments

Comments
 (0)