Skip to content

ci: Update pr-comment-artifact-url.yml #94

ci: Update pr-comment-artifact-url.yml

ci: Update pr-comment-artifact-url.yml #94

Workflow file for this run

name: Maven CI/CD
on:
push:
workflow_dispatch:
inputs:
evs_version:
description: "Overwrite EVS version (default to the one in release/version_input.txt)"
required: false
create_release:
description: "Produce the release artifacts"
required: false
default: false
type: boolean
jobs:
build_and_test:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: ☕ Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: 🚀 Cache the Maven packages to speed up build
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: ✨ Fix permissions
run: |
chmod u+x builder/release.sh
- name: 👀 Detect wanted version
shell: bash
run: |
if [[ -z "${{ github.event.inputs.evs_version }}" ]]; then
export EVS_VERSION=$(head -n 1 release/version_input.txt)
else
export EVS_VERSION=${{ github.event.inputs.evs_version }}
fi
echo "EVS_VERSION=${EVS_VERSION}" >> $GITHUB_ENV
- name: 📨 Set wanted version
run: |
echo "${{ env.EVS_VERSION }}" > release/version_input.txt
- name: 🔨 Build project with Maven
shell: bash
run: |
cd builder && ./release.sh
- name: 🚧 Workaround actions/upload-artifact#176
run: |
echo "artifacts_path=$(realpath ../builds/${{ env.EVS_VERSION }})" >> $GITHUB_ENV
- name: 🧰 Create release zip
run: |
find ${{ env.artifacts_path }} -type f \( -name ".gitignore" -o -name ".gitkeep" \) -exec rm -f {} \;
zip -r -q EVS-${{ env.EVS_VERSION }}.zip ${{ env.artifacts_path }}
- name: 📁 Archive artifacts
uses: actions/upload-artifact@v3
with:
name: EVS-build
# I don't want the double-zip issue in artifact
# https://github.com/actions/upload-artifact#zipped-artifact-downloads
path: "${{ env.artifacts_path }}"
if-no-files-found: error
retention-days: 1
- uses: ncipollo/[email protected]
name: 🤖 Create release on Github
if: github.event.inputs.create_release && contains(github.ref, 'main')
with:
artifacts: "EVS-${{ env.EVS_VERSION }}.zip"
allowUpdates: "true"
tag: "${{ env.EVS_VERSION }}"
commit: "main"
name: "EVS-${{ env.EVS_VERSION }}"