diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..cba337a6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Snapshot Release + +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+-SNAPSHOT + - v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-SNAPSHOT + - v[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+-[0-9a-zA-Z]+-SNAPSHOT + +env: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + +concurrency: + group: '${{ github.workflow }}-${{ github.ref }}' + cancel-in-progress: true + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + + - name: Run Unit Tests + run: ./gradlew test + working-directory: efsity-cli + + - name: Generate & upload library snapshot artifact AAR (Android Archive) file + run: ./gradlew clean publishMavenPublicationToSonatypeRepository --stacktrace -PSonatypeUsername=${{ secrets.NEXUS_USERNAME }} -PSonatypePassword=${{ secrets.NEXUS_PASSWORD }} + working-directory: efsity-cli + + - name: Github Release + uses: softprops/action-gh-release@v2 + with: + prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') }} diff --git a/efsity-cli/README.md b/efsity-cli/README.md index 8d01e666..ed2f33da 100644 --- a/efsity-cli/README.md +++ b/efsity-cli/README.md @@ -306,6 +306,25 @@ SonatypePassword= ./gradlew clean publishMavenPublicationToMavenLocal ``` +### Snapshot Artifact Releases + +To publish an artifact snapshot automatically, all you need to do is push a new tag, which then triggers the CI to generate and publish it. The configuration requires the tag to have a prefix in the glob pattern format: + +**v[0-9]+.[0-9]+.[0-9]+[0-9a-zA-Z.-]+-SNAPSHOT** + +For example the following are all valid tags that will trigger the generation of a release + +v2.0.0-SNAPSHOT + +v2.0.0-efsity-SNAPSHOT + +v2.0.0-efsity-rc1-SNAPSHOT + + +_Note_: when creating a tag for efsity version 2.0.0 for example, use the command: + +`git tag -a v2.0.0-efsity -s && git push origin v2.0.0-efsity` + ### Testing To run all tests: