From 3a595ef02d46b1308e2fa7eea2b9570dda759a72 Mon Sep 17 00:00:00 2001 From: 0xbadbee Date: Sat, 12 Aug 2023 01:15:28 +0200 Subject: [PATCH] Update build_release_test.yml --- .github/workflows/build_release_test.yml | 60 +++++++++++++++++++++--- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_release_test.yml b/.github/workflows/build_release_test.yml index a0917bb8..dfb44349 100644 --- a/.github/workflows/build_release_test.yml +++ b/.github/workflows/build_release_test.yml @@ -2,42 +2,90 @@ name: Build and zip on: workflow_dispatch: + push: + tags: + - tc_nightly + - tc_v* jobs: - build-windows: + build-windows-amd64: runs-on: windows-latest + outputs: + upload_url: ${{ steps.set_data1.outputs.upload_url }} + steps: + + - uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Build windows + id: build-zip + run: make build + - name: Check windows executable existence + id: check_release + uses: andstor/file-existence-action@v1 + with: + files: "./bin/teddybench.exe" + allow_failure: false + - name: File exist + if: steps.check_files.outputs.files_exists == 'true' + run: echo windows release zip exists! + - uses: actions/upload-artifact@master + with: + name: windows-exe + path: /bin/teddybench.exe + + + build-linux-amd64: + runs-on: ubuntu-latest outputs: upload_url: ${{ steps.set_data1.outputs.upload_url }} appendix: ${{ steps.set_data2.outputs.appendix }} steps: + - name: Install build dependencies + run: sudo apt-get install -y --no-install-recommends gcc protobuf-c-compiler build-essential - name: Get current datetime id: get-datetime run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - name: Set templates for nightly id: set-templates-nightly + if: startsWith(github.ref, 'refs/tags/tc_nightly') run: | echo "TAG_NAME=${GITHUB_REF#refs/tags/}_${{ env.CURRENT_DATE }}_${{ github.run_number }}" >> $GITHUB_ENV echo "RELEASE_NAME=Nightly ${{ env.CURRENT_DATE }} - Run ID ${{ github.run_number }}" >> $GITHUB_ENV echo "ASSET_APPENDIX=nightly_${{ env.CURRENT_DATE }}.${{ github.run_number }}" >> $GITHUB_ENV echo "IS_PRERELEASE=true" >> $GITHUB_ENV + + - name: Set templates for release and delete trigger tag + id: set-templates-release + if: startsWith(github.ref, 'refs/tags/tc_v') + run: | + echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + echo "RELEASE_NAME=Release ${GITHUB_REF#refs/tags/tc_}" >> $GITHUB_ENV + echo "ASSET_APPENDIX=release_${GITHUB_REF#refs/tags/tc_}" >> $GITHUB_ENV + echo "IS_PRERELEASE=false" >> $GITHUB_ENV - uses: actions/checkout@v2 with: submodules: recursive + - uses: actions/download-artifact@master + with: + name: windows-exe + path: /bin/teddybench.exe - - name: Build and zip windows + - name: Build and zip amd64 id: build-zip run: make zip - - name: Check windows release zip existence + - name: Check amd64 release zip existence id: check_release uses: andstor/file-existence-action@v1 with: files: "./install/zip/release.zip" - allow_failure: true + allow_failure: false - name: File exist if: steps.check_files.outputs.files_exists == 'true' - run: echo windows release zip exists! + run: echo amd64 release zip exists! - name: Create Release id: create_release @@ -58,7 +106,7 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps asset_path: ./install/zip/release.zip - asset_name: teddycloud.windows.${{ env.ASSET_APPENDIX }}.zip + asset_name: teddycloud.amd64.${{ env.ASSET_APPENDIX }}.zip asset_content_type: application/zip - id: set_data1 run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> "$GITHUB_OUTPUT"