Update README.md #127
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: 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: | | |
cd ${{ env.artifacts_path }} | |
find . -type f \( -name ".gitignore" -o -name ".gitkeep" \) -exec rm -f {} \; | |
zip -r -q EVS-${{ env.EVS_VERSION }}.zip . | |
- name: 📁 Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: EVS-build | |
path: "${{ env.artifacts_path }}/EVS-${{ env.EVS_VERSION }}.zip" | |
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: "${{ env.artifacts_path }}/EVS-${{ env.EVS_VERSION }}.zip" | |
allowUpdates: "true" | |
tag: "${{ env.EVS_VERSION }}" | |
commit: "main" | |
name: "EVS-${{ env.EVS_VERSION }}" |