Merge pull request #378 from sentrysoftware/feature/issue-316-feature… #138
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: Deploy | |
on: | |
push: | |
branches: [ "main" ] | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build-main: | |
permissions: | |
contents: write | |
packages: write | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest ] | |
steps: | |
- name: Install gcc-multilib | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-multilib | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Set up Maven settings.xml on ${{ matrix.os }} | |
uses: s4u/[email protected] | |
with: | |
repositories: '[{"id":"github","name":"MetricsHub JRE Builder","url":"https://maven.pkg.github.com/sentrysoftware/metricshub-jre-builder","snapshots":{"enabled":true},"releases":{"enabled":true}}]' | |
servers: '[{"id": "ossrh", "username": "${env.OSSRH_USERNAME}", "password": "${env.OSSRH_TOKEN}"}]' | |
sonatypeSnapshots: true | |
- name: Build with Maven on ${{ matrix.os }} | |
run: mvn -B -U deploy --file pom.xml | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
- name: Get version | |
run: | | |
metricshub_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo "MetricsHub version ${metricshub_version}" | |
echo "metricshub_version=$metricshub_version" >> $GITHUB_ENV | |
- name: Upload Linux Artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
with: | |
name: metricshub-linux-package-${{ env.metricshub_version }} | |
path: ./metricshub-linux/target/metricshub-linux-${{ env.metricshub_version }}.tar.gz | |
- name: Upload Windows Artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ matrix.os == 'windows-latest' }} | |
with: | |
name: metricshub-windows-package-${{ env.metricshub_version }} | |
path: ./metricshub-windows/target/metricshub-windows-${{ env.metricshub_version }}.zip | |
- name: Upload Site Artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
with: | |
name: metricshub-site-${{ env.metricshub_version }} | |
path: ./metricshub-doc/target/metricshub-doc-${{ env.metricshub_version }}-site.jar | |
- name: Upload Docker Artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
with: | |
name: metricshub-docker-package-${{ env.metricshub_version }} | |
path: ./metricshub-linux/target/metricshub-linux-${{ env.metricshub_version }}-docker.tar.gz | |