Skip to content

Release

Release #101

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
branch:
description: "The infinispan-quarkus branch to checkout when cutting the release."
required: true
default: "14.0.x"
infinispanVersion:
description: "Infinispan version to use for the release."
required: true
default: "X.Y.Z"
currentVersion:
description: "The current SNAPSHOT version of the branch to cut the release from."
required: true
releaseVersion:
description: "Release version."
required: true
default: "X.Y.Z"
developmentVersion:
description: "Next development version."
required: true
default: "X.Y.Z-SNAPSHOT"
jobs:
release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
steps:
- name: Checkout Source
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.branch }}
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.0'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git User
run: |
git config user.email "[email protected]"
git config user.name "Infinispan"
- name: Tag release
run: |
sed -i '9s/<version>.*<\/version>/<version>${{ github.event.inputs.infinispanVersion }}<\/version>/' pom.xml
find . -name "pom.xml" | xargs sed -i 's/<version>${{ github.event.inputs.currentVersion }}<\/version>/<version>${{ github.event.inputs.releaseVersion }}<\/version>/g'
grep SNAPSHOT --include pom.xml --recursive . && exit 1
git commit -a -m "Releasing ${{ github.event.inputs.releaseVersion }}"
git tag ${{ github.event.inputs.releaseVersion }}
sed -i '9s/<version>.*<\/version>/<version>${{ github.event.inputs.developmentVersion }}<\/version>/' pom.xml
find . -name "pom.xml" | xargs sed -i 's/<version>${{ github.event.inputs.releaseVersion }}<\/version>/<version>${{ github.event.inputs.developmentVersion }}<\/version>/g'
git commit -a -m "Next version ${{ github.event.inputs.developmentVersion }}"
# Ensure the tagged release can be be built
- name: Build release
run: |
git checkout ${{ github.event.inputs.releaseVersion }}
mvn package -s maven-settings.xml -DskipTests=true -Prelease
git checkout ${{ github.event.inputs.branch }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.inputs.branch }}
tags: true
- id: release
name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.releaseVersion }}
release_name: ${{ github.event.inputs.releaseVersion }}
publish:
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.releaseVersion }}
- name: Set up Java for publishing to OSSRH
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.INFINISPAN_MAVEN_GPG_ARMORED }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to OSSRH
run: mvn -B deploy -Prelease -Pcommunity-release -DskipTests -Dmaven.javadoc.skip=true -P \!native -pl \!integration-tests/server
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.INFINISPAN_MAVEN_GPG_PASSPHRASE }}
build:
needs: release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2022]
include:
- os: ubuntu-latest
asset_name: linux-amd64
gu_binary: gu
- os: macos-latest
asset_name: darwin-amd64
gu_binary: gu
- os: windows-2022
asset_name: windows-amd64
gu_binary: gu.cmd
steps:
- uses: actions/checkout@v2
- if: ${{ matrix.os == 'windows-2022' }}
name: Add msbuild to PATH
uses: microsoft/[email protected]
- uses: graalvm/setup-graalvm@v1
with:
version: '22.3.0'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Release Tag
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.releaseVersion }}
- if: ${{ matrix.os == 'windows-2022' }}
name: Build native executable
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
mvnw.cmd package -s maven-settings.xml -Pdistribution -Pwindows -Pnative -am -pl cli -Prelease
shell: cmd
- if: ${{ matrix.os != 'windows-2022' }}
name: Build native executable
run: ./mvnw package -s maven-settings.xml -Pdistribution -Pnative -am -pl cli -Prelease
- name: Upload CLI native executable
id: upload-cli-native-executable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./cli/target/infinispan-cli-${{ github.event.inputs.releaseVersion }}.zip
asset_name: infinispan-cli-${{ github.event.inputs.releaseVersion }}-${{ matrix.asset_name }}.zip
asset_content_type: application/zip