Merge pull request #295 from lisa-analyzer/giacomo-boldini/typo #117
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
name: 'Gradle Build (master)' | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
build-and-cron: | |
runs-on: ubuntu-latest | |
steps: | |
- 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 | |
delete-only-pre-release-versions: "true" | |
- 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 | |
delete-only-pre-release-versions: "true" | |
- 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 | |
delete-only-pre-release-versions: "true" | |
- 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 | |
delete-only-pre-release-versions: "true" | |
- 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.txt" | |
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 |