Skip to content

Commit

Permalink
Use Github actions for post release cleanup
Browse files Browse the repository at this point in the history
 - Create Github Release and deploy fat-jar, sources and javadocs
 - Bump library version in README
 - Bump library version in project wiki
  • Loading branch information
pietrygamat committed Sep 20, 2021
1 parent 5019569 commit dd58baa
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/release-new-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,73 @@ jobs:
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
PGP_KEY_PASSPHRASE: ${{ secrets.JAVA_NATIVE_PGP_KEY_PASSPHRASE }}
- run: echo "releaseTag=$(git tag --points-at HEAD^)" >> $GITHUB_ENV
- run: echo "releaseVersion=$(echo ${{ env.releaseTag }} | cut -c2-)" >> $GITHUB_ENV
- name: Push changes back to repo
run: git push && git push --tags --force
outputs:
releaseTag: ${{ env.releaseTag }}
releaseVersion: ${{ env.releaseVersion }}

github-release:
runs-on: ubuntu-latest
needs: maven-central-release
steps:
- uses: actions/checkout@v2
with:
ref: ${{ needs.maven-central-release.outputs.releaseTag }}
- run: git config --global user.email "${GITHUB_BOT_EMAIL}"
- run: git config --global user.name "${GITHUB_BOT_NAME}"
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
- name: Build jar with dependencies included
run: mvn -B install -Ppackage,jar-with-dependencies
- name: Publish as release
uses: ncipollo/release-action@v1
with:
name: ${{ needs.maven-central-release.outputs.releaseVersion }}
tag: ${{ needs.maven-central-release.outputs.releaseTag }}
allowUpdates: true
artifacts: target/*.jar
token: ${{ secrets.GITHUB_TOKEN }}

update-readme:
runs-on: ubuntu-latest
needs: maven-central-release
env:
ver: ${{ needs.maven-central-release.outputs.releaseVersion }}
steps:
- uses: actions/checkout@v2
- run: |
git config --global user.email "${GITHUB_BOT_EMAIL}"
git config --global user.name "${GITHUB_BOT_NAME}"
- run: |
sed -i "/<artifactId>jssc<\/artifactId>/{n;s/<version>.*<\/version>/<version>${ver}<\/version>/}" README.md
sed -i'.bak' -e "s/java-native:jssc:[A-Za-z0-9.-]*/java-native:jssc:${ver}/g" README.md
- run: |
if [ $(git ls-files --modified) ]; then
git commit --all --message "Update versions in source files after new release" && git pull --rebase && git push
fi
update-wiki:
runs-on: ubuntu-latest
needs: maven-central-release
env:
ver: ${{ needs.maven-central-release.outputs.releaseVersion }}
steps:
- uses: actions/checkout@v2
with:
repository: ${{github.repository}}.wiki
- run: |
git config --global user.email "${GITHUB_BOT_EMAIL}"
git config --global user.name "${GITHUB_BOT_NAME}"
- run: |
sed -i "/<artifactId>jssc<\/artifactId>/{n;s/<version>.*<\/version>/<version>${ver}<\/version>/}" Add-Dependency.md
sed -i'.bak' -e "s/java-native:jssc:[A-Za-z0-9.-]*/java-native:jssc:${ver}/g" Add-Dependency.md
- run: |
if [ $(git ls-files --modified) ]; then
git commit --all --message "Update wiki with latest version released to Maven Central" && git pull --rebase && git push
fi
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
</goals>
<configuration>
<skipAssembly>${jar.dependencies.skip}</skipAssembly>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
Expand Down

0 comments on commit dd58baa

Please sign in to comment.