Revert "bump commons version" #85
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: Continuous Delivery | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/**' | |
- '**/README.md' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bump version and create tag | |
id: semanticversion | |
uses: mathieudutour/[email protected] | |
with: | |
release_branches: master | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Verify and print new build number | |
run: | | |
if echo '${{ steps.semanticversion.outputs.new_tag }}' |grep -Eq '^v[0-9]+[.][0-9]+[.][0-9]+$'; then | |
echo Tag '${{ steps.semanticversion.outputs.new_tag }}', New version '${{ steps.semanticversion.outputs.new_version }}', Changelog '${{ steps.semanticversion.outputs.changelog }}' | |
else | |
echo 'unexpected tag format - aborting' | |
exit -1 | |
fi | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
cache: 'maven' | |
## Build with maven | |
- name: Prepare maven settings | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
mkdir -p ~/.m2 | |
echo "<settings><servers><server><id>github</id><username>x-access-token</username><password>${GITHUB_TOKEN}</password></server></servers></settings>" > ~/.m2/settings.xml | |
- name: Set version | |
id: version | |
run: | | |
echo Releasing as ${{ steps.semanticversion.outputs.new_version }} | |
mvn versions:set -DnewVersion=${{ steps.semanticversion.outputs.new_version }} | |
- name: Perform build | |
run: mvn -B package --file pom.xml | |
## Deploy | |
- name: Deploy package | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
REPOSITORY_URL: ${{ secrets.REPOSITORY_URL }} | |
REPOSITORY_USERID: ${{ secrets.REPOSITORY_USERID }} | |
REPOSITORY_CREDENTIALS: ${{ secrets.REPOSITORY_CREDENTIALS }} | |
run: | | |
mkdir -p ~/.m2 | |
echo "<settings><servers><server><id>neverpile</id><username>${REPOSITORY_USERID}</username><password>${REPOSITORY_CREDENTIALS}</password></server></servers></settings>" > ~/.m2/settings.xml | |
mvn deploy -Dmaven.test.skip.exec=true -DaltDeploymentRepository=neverpile::default::${REPOSITORY_URL} | |
## Update README.md | |
- name: Edit README.md to contain version number | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git checkout master | |
git reset --hard HEAD | |
sed -ri "s,<version>.*</version>,<version>${{ steps.semanticversion.outputs.new_version }}</version>," README.md | |
sed -ri "s,version-[0-9a-z.]+-,version-${{ steps.semanticversion.outputs.new_version }}-," README.md | |
sed -ri "s,neverpile-fusion/tree/[0-9a-z.]+,neverpile-fusion/tree/${{ steps.semanticversion.outputs.new_tag }}," README.md | |
git add README.md | |
git commit -m "Edit README.md to contain correct version" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: master | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Notify developers | |
uses: 8398a7/action-slack@v3 | |
with: | |
username: GitHub | |
icon_emoji: octocat | |
status: ${{ job.status }} | |
fields: repo,message,commit,author,action,eventName,ref | |
text: Released new version `${{ steps.semanticversion.outputs.new_version }}` of *${{ github.repository }}* ${{ github.workflow }} ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: always() |