Fix github actions workflow

This commit is contained in:
Andrea Cavalli 2023-05-11 01:14:09 +02:00
parent 35bdc5653c
commit daae6a3cd2

View File

@ -5,6 +5,11 @@ name: Maven Package
on: on:
push: push:
branches:
- master
- develop
tags:
- 'v*'
jobs: jobs:
build: build:
@ -14,27 +19,24 @@ jobs:
- { os: ubuntu-20.04, arch: "linux/amd64" } - { os: ubuntu-20.04, arch: "linux/amd64" }
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Branch name - name: Branch name and revision
id: branch_name id: branch_name
run: | run: |
set -xeo pipefail set -xeo pipefail
echo "SOURCE_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV export SOURCE_NAME="${GITHUB_REF#refs/*/}"
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV export SOURCE_BRANCH="${GITHUB_REF#refs/heads/}"
echo "SOURCE_TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV export SOURCE_TAG="${GITHUB_REF#refs/tags/}"
export SOURCE_TAG_VERSION="${GITHUB_REF#refs/tags/v}"
export REVISION="$SOURCE_TAG_VERSION"
echo "SOURCE_TAG_VERSION=$SOURCE_TAG_VERSION" >> $GITHUB_ENV
echo "REVISION=$REVISION" >> $GITHUB_ENV
cat $GITHUB_ENV > github.env cat $GITHUB_ENV > github.env
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: "recursive" submodules: "recursive"
- name: Setup variables
shell: bash
run: |
set -xeo pipefail
# ====== Variables
export REVISION=${{ steps.branch_name.outputs.SOURCE_TAG_VERSION }}
echo "REVISION=$REVISION" >> $GITHUB_ENV
cat $GITHUB_ENV >> github.env
- name: Set up JDK 17 (Snapshot) - name: Set up JDK 17 (Snapshot)
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: actions/setup-java@v3 uses: actions/setup-java@v3