File tree Expand file tree Collapse file tree 5 files changed +100
-2
lines changed Expand file tree Collapse file tree 5 files changed +100
-2
lines changed Original file line number Diff line number Diff line change 11name : Publish Native Android Library
22
3- on : workflow_dispatch
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ version :
7+ description : " Version being released"
8+ required : false
49
510jobs :
611 publish-android :
Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - feat/automate-releases
8+
9+ jobs :
10+ release :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Checkout repository
15+ uses : actions/checkout@v4
16+ with :
17+ fetch-depth : 0 # needed for semantic-release
18+
19+ - name : Set up Node.js
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : 20
23+
24+ - name : Install Semantic Release and plugins
25+ run : |
26+ npm install -g semantic-release \
27+ @semantic-release/git \
28+ @semantic-release/changelog \
29+ @semantic-release/exec \
30+ @semantic-release/github \
31+ @semantic-release/commit-analyzer \
32+ @semantic-release/release-notes-generator
33+
34+ - name : Run Semantic Release
35+ env :
36+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37+ run : semantic-release
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ branches : [
3+ "main" ,
4+ "feat/automate-releases" ,
5+ ] ,
6+ plugins : [
7+ "@semantic-release/commit-analyzer" ,
8+ "@semantic-release/release-notes-generator" ,
9+ [
10+ "@semantic-release/changelog" ,
11+ {
12+ changelogFile : "CHANGELOG.md" ,
13+ } ,
14+ ] ,
15+ [
16+ "@semantic-release/exec" ,
17+ {
18+ // Step 1: bump version in pom.xml
19+ prepareCmd : `
20+ echo "Updating pom.xml version to \${nextRelease.version}"
21+ sed -i'' -e 's#<version>.*</version>#<version>\${nextRelease.version}</version>#' pom.xml
22+ ` ,
23+ // Step 2: trigger publish workflow after release is done
24+ successCmd : `
25+ echo "Triggering publish-android.yml workflow..."
26+ curl -X POST \
27+ -H "Accept: application/vnd.github+json" \
28+ -H "Authorization: Bearer $GITHUB_TOKEN" \
29+ https://api.github.com/repos/ionic-team/ion-android-geolocation/actions/workflows/publish-android.yml/dispatches \
30+ -d '{"ref": "main", "inputs": {"version": "\${nextRelease.version}"}}'
31+ ` ,
32+ } ,
33+ ] ,
34+ [
35+ "@semantic-release/git" ,
36+ {
37+ assets : [ "CHANGELOG.md" , "pom.xml" ] ,
38+ message : "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" ,
39+ } ,
40+ ] ,
41+ "@semantic-release/github" ,
42+ ] ,
43+ } ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " ion-android-geolocation" ,
3+ "private" : true ,
4+ "devDependencies" : {
5+ "semantic-release" : " ^25.0.1" ,
6+ "@semantic-release/changelog" : " ^6.0.3" ,
7+ "@semantic-release/git" : " ^10.0.1" ,
8+ "@semantic-release/commit-analyzer" : " ^13.0.0" ,
9+ "@semantic-release/release-notes-generator" : " ^14.0.1" ,
10+ "@semantic-release/exec" : " ^6.0.3" ,
11+ "@semantic-release/github" : " ^10.0.3"
12+ }
13+ }
Original file line number Diff line number Diff line change 2121
2222 printf %" s\n" " Attempting to build and publish version $THE_VERSION "
2323 # Publish a release to the Maven repo
24- " $ANDROID_PATH " /gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b " $ANDROID_PATH " /build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1
24+ # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1
2525 # Stage a version
2626 # "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1
2727
You can’t perform that action at this time.
0 commit comments