diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index 54056bb5c..026e7b67e 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -5,6 +5,7 @@ on: branches: - features/* - beta + - master pull_request: schedule: - cron: '0 2 * * *' @@ -159,6 +160,7 @@ jobs: fi echo VCMI_PACKAGE_FILE_NAME="$VCMI_PACKAGE_FILE_NAME" >> $GITHUB_ENV echo VCMI_PACKAGE_NAME_SUFFIX="$VCMI_PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV + echo VCMI_PACKAGE_GITVERSION="$VCMI_PACKAGE_GITVERSION" >> $GITHUB_ENV env: PULL_REQUEST: ${{ github.event.pull_request.number }} @@ -172,7 +174,8 @@ jobs: ${{matrix.cmake_args}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DENABLE_TEST=${{matrix.test}} \ -DPACKAGE_NAME_SUFFIX:STRING="$VCMI_PACKAGE_NAME_SUFFIX" \ - -DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME" + -DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME" \ + -DENABLE_GITVERSION="$VCMI_PACKAGE_GITVERSION" env: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} @@ -223,7 +226,7 @@ jobs: ${{github.workspace}}/**/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }} - name: Upload build - if: ${{ matrix.pack == 1 && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/beta' || startsWith(github.ref, 'refs/heads/features/')) && matrix.platform != 'msvc' }} + if: ${{ matrix.pack == 1 && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/features/')) && matrix.platform != 'msvc' }} run: | cd '${{github.workspace}}/out/build/${{matrix.preset}}' source '${{github.workspace}}/CI/upload_package.sh' @@ -241,7 +244,7 @@ jobs: - name: Trigger Android uses: peter-evans/repository-dispatch@v1 - if: ${{ github.ref == 'refs/heads/develop' && matrix.platform == 'mxe' }} + if: ${{ (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master') && matrix.platform == 'mxe' }} with: token: ${{ secrets.VCMI_ANDROID_ACCESS_TOKEN }} repository: vcmi/vcmi-android diff --git a/CI/get_package_name.sh b/CI/get_package_name.sh index 94554ff2e..235e39930 100644 --- a/CI/get_package_name.sh +++ b/CI/get_package_name.sh @@ -27,16 +27,27 @@ fi VCMI_PACKAGE_FILE_NAME="${TMP_JOBID}-vcmi" VCMI_PACKAGE_NAME_SUFFIX="" +VCMI_PACKAGE_GITVERSION="ON" if [ -z "$TMP_PRID" ] || [ "$TMP_PRID" == "false" ]; then branch_name=$(echo "$TMP_BRANCH" | sed 's/[^[:alnum:]]\+/_/g') VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-branch-${branch_name}-${TMP_COMMIT}" - VCMI_PACKAGE_NAME_SUFFIX="branch ${branch_name}" + if [ "${branch_name}" != "master" ]; + then + VCMI_PACKAGE_NAME_SUFFIX="branch ${branch_name}" + else + VCMI_PACKAGE_GITVERSION="OFF" + fi else VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-PR-${TMP_PRID}-${TMP_COMMIT}" VCMI_PACKAGE_NAME_SUFFIX="PR ${TMP_PRID}" fi -VCMI_PACKAGE_NAME_SUFFIX="(${VCMI_PACKAGE_NAME_SUFFIX})" + +if [ "${VCMI_PACKAGE_NAME_SUFFIX}" != "" ]; +then + VCMI_PACKAGE_NAME_SUFFIX="(${VCMI_PACKAGE_NAME_SUFFIX})" +fi export VCMI_PACKAGE_FILE_NAME export VCMI_PACKAGE_NAME_SUFFIX +export VCMI_PACKAGE_GITVERSION \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index 04d49edf2..3ea47c488 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -23,7 +23,8 @@ "PACKAGE_FILE_NAME" : "$env{VCMI_PACKAGE_FILE_NAME}", "PACKAGE_NAME_SUFFIX" : "$env{VCMI_PACKAGE_NAME_SUFFIX}", "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "ENABLE_TEST": "OFF" + "ENABLE_TEST": "OFF", + "ENABLE_GITVERSION": "$env{VCMI_PACKAGE_GITVERSION}" } }, {