-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support publishing through Github Actions
Add the necessary workflows to publish SNAPSHOT builds and stable releases.
- Loading branch information
Showing
5 changed files
with
154 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Publish Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
|
||
jobs: | ||
publish-release: | ||
runs-on: macos-latest | ||
if: github.repository == 'amzn/kotlin-inject-anvil' | ||
timeout-minutes: 25 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 21 | ||
- uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Publish release | ||
run: ./gradlew clean publish --no-build-cache --stacktrace --show-version | ||
env: | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY_PASSWORD }} | ||
|
||
- name: Extract release notes | ||
id: release_notes | ||
uses: ffurrer2/extract-release-notes@v2 | ||
|
||
- name: Check if pre-release | ||
id: prerelease | ||
run: | | ||
version=$(grep VERSION_NAME gradle.properties | cut -d'=' -f2) | ||
if [[ $version == *"-beta"* ]]; then | ||
echo "isPrerelease=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "isPrerelease=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Create release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
body: ${{ steps.release_notes.outputs.release_notes }} | ||
prerelease: ${{ steps.prerelease.outputs.isPrerelease }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish Snapshot | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish-snapshot: | ||
runs-on: macos-latest | ||
if: github.repository == 'amzn/kotlin-inject-anvil' | ||
timeout-minutes: 25 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 21 | ||
- uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Publish snapshot | ||
run: ./gradlew clean publish --no-build-cache --stacktrace --show-version | ||
env: | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY_PASSWORD }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Change Log | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
### Changed | ||
|
||
### Deprecated | ||
|
||
### Removed | ||
|
||
### Fixed | ||
|
||
### Security | ||
|
||
### Custom Code Generator | ||
|
||
### Other Notes & Contributions | ||
|
||
|
||
## [0.0.1] - 2024-09-05 | ||
|
||
- Initial release. | ||
|
||
[Unreleased]: https://github.com/amzn/kotlin-inject-anvil/compare/0.0.1...HEAD | ||
[0.0.1]: https://github.com/square/anvil/releases/tag/0.0.1 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Production Releases | ||
|
||
1. Checkout `origin/main`. | ||
2. Update the `CHANGELOG.md` file with the changes of this release (the format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). | ||
* Copy the template for the next unreleased version at the top. | ||
* Delete unused section in the new release. | ||
* Update the links at the bottom of the CHANGELOG.md file and don't forget to change the link for the unreleased version. | ||
3. Update the version in `gradle.properties` and remove the `-SNAPSHOT` suffix. | ||
4. Commit the changes and create a tag: | ||
``` | ||
git commit -am "Releasing 0.1.0." | ||
git tag 0.1.0 | ||
``` | ||
5. Update the version in `gradle.properties` and add the `-SNAPSHOT` suffix. | ||
6. Commit the change: | ||
``` | ||
git commit -am "Prepare next development version." | ||
``` | ||
7. Push the two commits. This will start a Github action that publishes the release to Maven Central and creates a new release on Github. | ||
``` | ||
git push && git push --tags | ||
``` | ||
|
||
# Snapshot Releases | ||
|
||
Snapshot releases are automatically created whenever a commit to the `main` branch is pushed. | ||
|
||
# Manually uploading a release | ||
|
||
Depending on the version in the `gradle.properties` file it will be either a production or snapshot release. | ||
``` | ||
./gradlew clean publish --no-build-cache | ||
``` | ||
|
||
# Installing in Maven Local | ||
|
||
``` | ||
./gradlew publishToMavenLocal | ||
``` |