Skip to content

Publish Release

Publish Release #22

name: Publish Release
on:
workflow_dispatch:
jobs:
Ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/[email protected]
with:
token: ${{ secrets.WSO2_INTEGRATION_BOT_TOKEN }}
fetch-depth: 0
- name: Set up JDK 11
uses: joschi/setup-jdk@v2
with:
distribution: 'adopt'
java-version: 11
- name: Configure Maven settings file
run: |
mkdir -p ~/.m2
echo "<settings>
<servers>
<server>
<id>nexus-releases</id>
<username>${{ secrets.NEXUS_USERNAME }}</username>
<password>${{ secrets.NEXUS_PASSWORD }}</password>
</server>
</servers>
</settings>" > ~/.m2/settings.xml
- name: Configure git credentials
run: |
git config --global user.name ${{ secrets.WSO2_INTEGRATION_BOT_USERNAME }}
git config --global user.email ${{ secrets.WSO2_INTEGRATION_BOT_EMAIL }}
- name: Build artifacts
run: |
mvn clean install
- name: Backup target directory
run: |
if [ -d "target" ]; then
tar -czf target-backup.tar.gz target/
fi
- name: Deploy artifacts with Maven
env:
GITHUB_TOKEN: ${{ secrets.WSO2_INTEGRATION_BOT_TOKEN }}
run: |
mvn --batch-mode release:prepare release:perform
- name: Restore target directory
run: |
if [ -f "target-backup.tar.gz" ]; then
tar -xzf target-backup.tar.gz
fi
- name: Create Release with Assets
env:
GITHUB_TOKEN: ${{ secrets.WSO2_INTEGRATION_BOT_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${tag#v}" \
--generate-notes \
target/*.zip