Skip to content

Release

Release #40

Workflow file for this run

name: Release
env:
MAVEN_ARGS: -B -e
on:
workflow_dispatch:
pull_request:
types: [closed]
paths:
- '.github/project.yml'
jobs:
release:
runs-on: ubuntu-latest
name: release
steps:
- uses: actions/checkout@v2
name: Checkout
- uses: radcortez/project-metadata-action@main
name: Retrieve project metadata
id: metadata
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yml'
local-file: true
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'temurin'
server-id: oss-sonatype-staging
server-username: OSS_SONATYPE_USERNAME
server-password: OSS_SONATYPE_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Configure Git author
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Maven release ${{steps.metadata.outputs.current-version}}
run: |
./mvnw clean install -DskipTests -Prelease
git checkout -b release
./mvnw -X -Prelease -B release:clean release:prepare -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} -Pwith-examples,with-tests,with-knative-examples,with-gradle-examples,with-dockerio,with-internal-registry,with-service-binding-examples,with-kubernetes-specific-examples,with-openshift-specific-examples
git checkout ${{github.base_ref}}
git rebase release
./mvnw -X -Prelease -B release:perform -DskipTests
#
# checkout release tag
#
git checkout ${{steps.metadata.outputs.current-version}}
git checkout -b "br-${{steps.metadata.outputs.current-version}}"
# update examples and tests
./mvnw versions:set -DnewVersion=${{steps.metadata.outputs.next-version}} -Pwith-examples,with-tests -DgenerateBackupPoms=false -DoldVersion=* -DgroupId=* -DartifactId=* -Pwith-examples,with-tests,with-knative-examples,with-gradle-examples,with-dockerio,with-internal-registry,with-service-binding-examples
# update readme.md
docker run -v `pwd`:/ws --workdir=/ws -i quay.io/jbangdev/jbang-action ./scripts/ChangeVersion.java readme.md io.dekorate ${{steps.metadata.outputs.next-version}} | tail -n +3 > readme.md.versionChanged
mv readme.md.versionChanged readme.md
# update site version
cp .github/project.yml docs/_data/project.yml
git add --all
# Check if there are changes to commit
if git diff-index --quiet HEAD --; then
echo "No changes to commit."
else
git commit -m "chore: Set docs, examples and tests version to ${{steps.metadata.outputs.current-version}}"
git tag -d ${{steps.metadata.outputs.current-version}}
git tag ${{steps.metadata.outputs.current-version}}
git push origin ${{steps.metadata.outputs.current-version}}
fi
#
# checkout release branch
#
git checkout ${{github.base_ref}}
# update examples and tests
./mvnw versions:set -DnewVersion=${{steps.metadata.outputs.next-version}} -Pwith-examples,with-tests -DgenerateBackupPoms=false -DoldVersion=* -DgroupId=* -DartifactId=* -Pwith-examples,with-tests,with-knative-examples,with-gradle-examples,with-dockerio,with-internal-registry,with-service-binding-examples
# update readme.md
docker run -v `pwd`:/ws --workdir=/ws -i quay.io/jbangdev/jbang-action ./scripts/ChangeVersion.java readme.md io.dekorate ${{steps.metadata.outputs.next-version}} | tail -n +3 > readme.md.versionChanged
mv readme.md.versionChanged readme.md
# update site version
cp .github/project.yml docs/_data/project.yml
git add --all
# Check if there are changes to commit
if git diff-index --quiet HEAD --; then
echo "No changes to commit."
else
git commit -m "chore: Set docs, examples and tests version to ${{steps.metadata.outputs.current-version}}"
git push origin ${{github.base_ref}}
fi
env:
OSS_SONATYPE_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
OSS_SONATYPE_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Push changes to ${{github.base_ref}}
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{github.base_ref}}
force: true