diff --git a/.github/workflows/check-builds.yaml b/.github/workflows/check-builds.yaml index 5d3ded5..e1a2683 100644 --- a/.github/workflows/check-builds.yaml +++ b/.github/workflows/check-builds.yaml @@ -13,6 +13,9 @@ jobs: ubuntu-build: runs-on: ubuntu-latest steps: + - name: Set environment + run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV + shell: bash - uses: actions/checkout@v2 with: submodules: recursive @@ -42,12 +45,15 @@ jobs: - name: Upload build artifact uses: actions/upload-artifact@v2 with: - name: ubuntu20_04-bin-x64 + name: 'ubuntu20_04-bin-x64-${{ env.SHORT_SHA }}' path: bin windows-build: runs-on: windows-2019 steps: + - name: Set environment + run: $s = $env:GITHUB_SHA.subString(0, 7); echo "SHORT_SHA=$s" >> $env:GITHUB_ENV + shell: pwsh - uses: actions/checkout@v2 with: submodules: recursive @@ -92,5 +98,36 @@ jobs: - name: Upload build artifact uses: actions/upload-artifact@v2 with: - name: windows-vs2019-bin-x64 + name: 'windows-vs2019-bin-x64-${{ env.SHORT_SHA }}' path: bin + + copy-artifacts: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + needs: [windows-build, ubuntu-build] + env: + BOT_SSH_KEY: ${{ secrets.BOT_SSH_KEY }} + ENDPOINT: ${{ secrets.ENDPOINT }} + steps: + - run: mkdir ${{ github.sha }} + - uses: actions/download-artifact@v3 + with: + path: ${{ github.sha }} + - name: Prepare artifacts + shell: bash + run: | + sudo apt install zip -y + cd ${{ github.sha }} + for build in *; do + cd $build + zip ../$build.zip * + cd .. + rm -r $build + done + cd .. + - name: Upload artifacts + shell: bash + run: | + umask 077 + printf %s "$BOT_SSH_KEY" > cdn_key + scp -i cdn_key -o StrictHostKeyChecking=no -r ${{ github.sha }} $ENDPOINT