version number update and ossrh migration #150
This file contains hidden or 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
| name: "Gradle Build (master)" | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| env: | |
| RAW_BRANCH: ${{ github.ref_name }} | |
| jobs: | |
| build-and-cron: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Sanitize branch name | |
| id: sanitize | |
| run: | | |
| SAFE_BRANCH="${RAW_BRANCH//\//-}" | |
| echo "safe_branch=$SAFE_BRANCH" >> "$GITHUB_OUTPUT" | |
| - name: "Checkout" | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 # needed to have the tags below | |
| - name: "Ensure git is installed" | |
| run: sudo apt-get install -y git | |
| - name: "Set up JDK 11" | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: 11 | |
| - name: "Grant execute permission for gradlew" | |
| run: chmod +x lisa/gradlew | |
| - name: "Gradle: full build and run cron tests" | |
| run: cd lisa && ./gradlew build cron | |
| - name: "Delete pre-releases of lisa-sdk from packages" | |
| uses: actions/delete-package-versions@v2 | |
| with: | |
| package-name: "io.github.lisa-analyzer.lisa-sdk" | |
| min-versions-to-keep: 0 | |
| # Keep all branch snapshots: <version>-<anything>-SNAPSHOT | |
| ignore-versions: "^[0-9.]+-.+-SNAPSHOT$" | |
| - name: "Delete pre-releases of lisa-program from packages" | |
| uses: actions/delete-package-versions@v2 | |
| with: | |
| package-name: "io.github.lisa-analyzer.lisa-program" | |
| min-versions-to-keep: 0 | |
| # Keep all branch snapshots: <version>-<anything>-SNAPSHOT | |
| ignore-versions: "^[0-9.]+-.+-SNAPSHOT$" | |
| - name: "Delete pre-releases of lisa-analyses from packages" | |
| uses: actions/delete-package-versions@v2 | |
| with: | |
| package-name: "io.github.lisa-analyzer.lisa-analyses" | |
| min-versions-to-keep: 0 | |
| # Keep all branch snapshots: <version>-<anything>-SNAPSHOT | |
| ignore-versions: "^[0-9.]+-.+-SNAPSHOT$" | |
| - name: "Delete pre-releases of lisa-imp from packages" | |
| uses: actions/delete-package-versions@v2 | |
| with: | |
| package-name: "io.github.lisa-analyzer.lisa-imp" | |
| min-versions-to-keep: 0 | |
| # Keep all branch snapshots: <version>-<anything>-SNAPSHOT | |
| ignore-versions: "^[0-9.]+-.+-SNAPSHOT$" | |
| - name: "Retrieve commit list" | |
| id: gitinfo | |
| run: | | |
| # get last tag excluding 'latest' and considering only version tags | |
| echo "most recent tags:" | |
| git tag --sort=-creatordate | head -n5 | |
| currenttag=$(git tag --sort=-creatordate | grep -v latest | grep "^v[0-9].*" | head -n1) | |
| echo "current tag: $currenttag" | |
| git log $currenttag..HEAD --pretty=format:"%C(auto)%h - %s" > changelog.txt | |
| function join_by { | |
| local d=${1-} f=${2-} | |
| if shift 2; then | |
| printf %s "$f" "${@/#/$d}" | |
| fi | |
| } | |
| # tokenize whenever we transition from numbers to whatever else | |
| # 5.2b4 -> (5 . 2 b 4) | |
| currentver=${currenttag#?} # remove the v | |
| echo "current version: $currentver" | |
| nexttag=( $(grep -oE '[0-9]+|[^0-9]+' <<< $currentver) ) | |
| let nexttag[-1]=${nexttag[-1]}+1 | |
| nextver=$(join_by "" "${nexttag[@]}") | |
| changelog=$(cat changelog.txt) | |
| echo "next version: $nextver" | |
| echo "changelog: $changelog" | |
| echo "nextver=$nextver" >> $GITHUB_OUTPUT | |
| echo "currentver=$currentver" >> $GITHUB_OUTPUT | |
| echo "CHANGELOG<<EOF" >> $GITHUB_ENV | |
| echo "$changelog" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - name: "Gradle: publish to GitHub Packages" | |
| env: | |
| SIGN_PW: ${{ secrets.SIGN_PASSPHRASE }} | |
| SIGN_KEY: ${{ secrets.SIGN_PRIVATE_KEY }} | |
| MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: cd lisa && ./gradlew -Pversion=${{ steps.gitinfo.outputs.nextver }}-SNAPSHOT publishAllPublicationsToGitHubPackagesRepository |