Files
sailing-analytics/.github/workflows/release.yml
T

128 lines
5.7 KiB
YAML

name: release
on:
push:
paths-ignore:
- 'wiki/**'
- '.github/workflows/*'
- '**/*.md'
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest-64cpu
#runs-on: ubuntu-latest-4cpu
steps:
- name: Check out the repository to the runner
uses: actions/checkout@v4
with:
fetch-depth: '500'
- name: Install JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '8'
mvn-toolchain-id: 'JavaSE-1.8'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
log-accepted-android-sdk-licenses: 'false'
cmdline-tools-version: 9123335 # This corresponds to human-friendly version number 8.0
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.10.0
with:
mongodb-version: 4.4
- name: Start RabbitMQ
uses: namoshek/rabbitmq-github-action@v1
with:
version: '3.8.9'
ports: '5672:5672'
- shell: bash
env: # Or as an environment variable
APP_PARAMETERS: "-Daws.region=eu-west-1 -Dgoogle.maps.authenticationparams=${{ secrets.GOOGLE_MAPS_AUTHENTICATIONPARAMS }} -Daws.s3.test.s3AccessId=${{ secrets.AWS_S3_TEST_S3ACCESSID }} -Daws.s3.test.s3AccessKey=${{ secrets.AWS_S3_TEST_S3ACCESSKEY }}"
JAVA8_HOME: ${{env.JAVA_HOME_8_X64}}
run: |
./configuration/buildAndUpdateProduct.sh -x 60 build 2>&1 | tee build.log
- name: Upload build log
uses: actions/upload-artifact@v4
if: always()
with:
name: build.log
path: build.log
retention-days: 90
- name: Collect Test Reports
uses: dorny/test-reporter@v1
if: always()
with:
name: Maven Tests
path: '**/TEST-*.xml'
max-annotations: '1'
list-suites: failed
list-tests: failed
reporter: java-junit
fail-on-error: true
- shell: bash
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
run: |
./configuration/buildAndUpdateProduct.sh -u -L release
- name: Determine release name
run: |
echo "SIMPLE_VERSION_INFO=$( basename dist/* )" >>${GITHUB_ENV}
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
**/surefire-reports/**
retention-days: 90
- name: Upload distribution artifact
uses: actions/upload-artifact@v4
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
with:
name: ${{ env.SIMPLE_VERSION_INFO }}
path: dist/**/*
retention-days: 90
- name: Create Release
id: create_release
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.SIMPLE_VERSION_INFO }}
name: ${{ env.SIMPLE_VERSION_INFO }}
draft: false
prerelease: false
- name: Upload Release Asset tar.gz
id: upload-release-asset-tar-gz
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./dist/${{ env.SIMPLE_VERSION_INFO }}/${{ env.SIMPLE_VERSION_INFO }}.tar.gz
asset_name: ${{ env.SIMPLE_VERSION_INFO }}.tar.gz
asset_content_type: application/x-tar
- name: Upload Release Asset release_notes.txt
id: upload-release-asset-release-notes-txt
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docker-17' || startsWith(github.ref, 'refs/heads/releases/') }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./dist/${{ env.SIMPLE_VERSION_INFO }}/release-notes.txt
asset_name: release-notes.txt
asset_content_type: text/plain
- name: Trigger Hudson job
if: always()
shell: bash
run: |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
JOB=SAPSailingAnalytics-master
elif [[ "${{ github.ref }}" =~ refs/heads/releases/.* ]]; then
JOB=$( echo "${{ github.ref }}" | sed -e 's/^refs\/heads\/releases\///' )
else
JOB=$( echo "${{ github.ref }}" | sed -e 's/^refs\/heads\///' )
fi
echo "Identified Hudson job: ${JOB}"
curl https://${{ secrets.HUDSON_JOB_USERNAME }}:${{ secrets.HUDSON_JOB_PASSWORD}}@hudson.sapsailing.com/job/${JOB}/build?token=${{ secrets.HUDSON_JOB_TOKEN }}