From 92a9106e89a2b4c837953b82c7114b0810c14f6a Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Mon, 12 Jul 2021 22:00:29 +0300 Subject: [PATCH] Disable publishing builds to download.vcmi.eu except develop. Added artifacts --- .github/workflows/github.yml | 34 +++++++++++++++++++++++++--------- CI/mxe/upload_package.sh | 17 ----------------- CI/{mac => }/upload_package.sh | 4 +--- 3 files changed, 26 insertions(+), 29 deletions(-) delete mode 100644 CI/mxe/upload_package.sh rename CI/{mac => }/upload_package.sh (77%) diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index 1370562bb..74f0858fd 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -1,9 +1,6 @@ name: CMake -on: - push: - pull_request: - branches: [ develop ] +on: [ push ] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -27,10 +24,14 @@ jobs: - platform: mac os: macos-latest test: 0 + pack: 1 + extension: dmg - platform: mxe os: ubuntu-20.04 mxe: i686-w64-mingw32.shared test: 0 + pack: 1 + extension: exe runs-on: ${{ matrix.os }} @@ -74,18 +75,17 @@ jobs: ninja - name: Test + if: ${{ matrix.test == 1 }} run: | cd ${{github.workspace}}/build ctest -C Release -V - if: ${{ matrix.test == 1 }} - - name: Upload build + - name: Pack id: cpack + if: ${{ matrix.pack == 1 }} run: | cd ${{github.workspace}}/build - source ${{github.workspace}}/CI/${{matrix.platform}}/upload_package.sh - env: - DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }} + cpack - name: Additional logs if: ${{ failure() && steps.cpack.outcome == 'failure' && matrix.platform == 'mxe' }} @@ -93,6 +93,22 @@ jobs: cat ${{github.workspace}}/build/_CPack_Packages/win32/NSIS/project.nsi cat ${{github.workspace}}/build/_CPack_Packages/win32/NSIS/NSISOutput.log + - name: Artifacts + if: ${{ matrix.pack == 1 }} + uses: actions/upload-artifact@v2 + with: + name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }} + path: ${{github.workspace}}/build/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }} + + - name: Upload build + if: ${{ matrix.pack == 1 && github.ref == 'refs/heads/develop' }} + run: | + cd ${{github.workspace}}/build + source ${{github.workspace}}/CI/${{matrix.platform}}/upload_package.sh + env: + DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }} + PACKAGE_EXTENSION: ${{ matrix.extension }} + - uses: act10ns/slack@v1 with: status: ${{ job.status }} diff --git a/CI/mxe/upload_package.sh b/CI/mxe/upload_package.sh deleted file mode 100644 index 59c017538..000000000 --- a/CI/mxe/upload_package.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -if [ -z "$DEPLOY_RSA" ]; -then - # Due to security measures travis not expose encryption keys for PR from forks - echo "Build generation is skipped for forks" - exit 0 -fi - -cpack - -echo "$DEPLOY_RSA" > /tmp/deploy_rsa -chmod 600 /tmp/deploy_rsa - -eval "$(ssh-agent -s)" -ssh-add /tmp/deploy_rsa - -sftp -r -o StrictHostKeyChecking=no travis@beholder.vcmi.eu <<< "put $VCMI_PACKAGE_FILE_NAME.exe /incoming/$VCMI_PACKAGE_FILE_NAME.exe" diff --git a/CI/mac/upload_package.sh b/CI/upload_package.sh similarity index 77% rename from CI/mac/upload_package.sh rename to CI/upload_package.sh index a4e4bd21d..5455dabf5 100644 --- a/CI/mac/upload_package.sh +++ b/CI/upload_package.sh @@ -6,12 +6,10 @@ then exit 0 fi -cpack - echo "$DEPLOY_RSA" > /tmp/deploy_rsa chmod 600 /tmp/deploy_rsa eval "$(ssh-agent -s)" ssh-add /tmp/deploy_rsa -sftp -r -o StrictHostKeyChecking=no travis@beholder.vcmi.eu <<< "put $VCMI_PACKAGE_FILE_NAME.dmg /incoming/$VCMI_PACKAGE_FILE_NAME.dmg" +sftp -r -o StrictHostKeyChecking=no travis@beholder.vcmi.eu <<< "put $VCMI_PACKAGE_FILE_NAME.$PACKAGE_EXTENSION /incoming/$VCMI_PACKAGE_FILE_NAME.$PACKAGE_EXTENSION"