diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c1e3f8..20cae1b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,5 @@ name: OctoBot-Binary-CI on: - schedule: - - cron: '0 5 * * 1' # every monday at 5am push: jobs: @@ -103,97 +101,25 @@ jobs: path: OctoBot/dist/OctoBot_windows.exe if-no-files-found: error - upload-binaries: - name: Upload binaries - needs: builds - runs-on: ubuntu-20.04 - steps: - - name: Set version as environement var - id: vars - run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} - - - name: Download artifacts - uses: actions/download-artifact@v3 - - - name: Clean artifact names - run: | - sudo apt-get update - sudo apt-get install rename -y - find . -type f -exec bash -c 'mv $1 $(basename $(dirname $1)).tmp && rm -rf $(basename $(dirname $1)) && rename 's/\.tmp$//' *.tmp' _ {} \; - - - name: Compute hashes - run: | - sha256sum OctoBot_linux_x64 > OctoBot_linux_x64.sha256sum - sha256sum OctoBot_linux_arm64 > OctoBot_linux_arm64.sha256sum - sha256sum OctoBot_macos_x64 > OctoBot_macos_x64.sha256sum - sha256sum OctoBot_windows_x64.exe > OctoBot_windows_x64.exe.sha256sum - - - name: Upload binary as weekly - if: github.event_name == 'schedule' - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read - env: - AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }} - AWS_ACCESS_KEY_ID: ${{ secrets.S3_API_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_API_SECRET_KEY }} - AWS_REGION: ${{ secrets.S3_REGION_NAME }} - AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT_URL }} - SOURCE_DIR: $GITHUB_WORKSPACE - DEST_DIR: ${{ secrets.WEEKLY_DIR }} - - - name: Upload binary as latest - if: github.event_name != 'schedule' - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read - env: - AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }} - AWS_ACCESS_KEY_ID: ${{ secrets.S3_API_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_API_SECRET_KEY }} - AWS_REGION: ${{ secrets.S3_REGION_NAME }} - AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT_URL }} - SOURCE_DIR: $GITHUB_WORKSPACE - DEST_DIR: ${{ secrets.LATEST_DIR }} - - - name: Upload binary as stable - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read - env: - AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }} - AWS_ACCESS_KEY_ID: ${{ secrets.S3_API_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_API_SECRET_KEY }} - AWS_REGION: ${{ secrets.S3_REGION_NAME }} - AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT_URL }} - SOURCE_DIR: $GITHUB_WORKSPACE - DEST_DIR: ${{ secrets.STABLE_DIR }} - - - name: Upload release binary - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: jakejarvis/s3-sync-action@master - with: - args: --acl public-read - env: - AWS_S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }} - AWS_ACCESS_KEY_ID: ${{ secrets.S3_API_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_API_SECRET_KEY }} - AWS_REGION: ${{ secrets.S3_REGION_NAME }} - AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT_URL }} - SOURCE_DIR: $GITHUB_WORKSPACE - DEST_DIR: ${{ steps.vars.outputs.tag }} - create-release: name: Create Release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - needs: upload-binaries + needs: builds runs-on: ubuntu-20.04 steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + - name: Set version as environement var id: vars run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + - name: Clean artifact names + run: | + sudo apt-get update + sudo apt-get install rename -y + find . -type f -exec bash -c 'mv $1 $(basename $(dirname $1)).tmp && rm -rf $(basename $(dirname $1)) && rename 's/\.tmp$//' *.tmp' _ {} \; + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -208,14 +134,52 @@ jobs: prerelease: false commitish: master body: | - | Binary | Download link | - | ------------- |:-------------:| - | Windows x64 | [Download](${{ secrets.RELEASE_BASE_URL }}${{ steps.vars.outputs.tag }}/OctoBot_windows_x64.exe) | - | Linux x64 | [Download](${{ secrets.RELEASE_BASE_URL }}${{ steps.vars.outputs.tag }}/OctoBot_linux_x64) | - | Linux arm64 | [Download](${{ secrets.RELEASE_BASE_URL }}${{ steps.vars.outputs.tag }}/OctoBot_linux_arm64) | - | MacOS x64 | [Download](${{ secrets.RELEASE_BASE_URL }}${{ steps.vars.outputs.tag }}/OctoBot_macos_x64) | - - Add .sha256sum to the download url to get each binary checksum + | Binary | Download link | SHA256 | + | ------------- |:-------------:|:-------------:| + | Windows x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_windows_x64.exe) | ${{ steps.hashes.outputs.octobot_windows_x64_hash }} | + | Linux x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_linux_x64) | ${{ steps.hashes.outputs.octobot_linux_x64_hash }} | + | Linux arm64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_linux_arm64) | ${{ steps.hashes.outputs.octobot_linux_arm64_hash }} | + | MacOS x64 | [Download](https://github.com/${{ github.repository_owner }}/OctoBot/releases/download/${{ steps.vars.outputs.tag }}/OctoBot_macos_x64) | ${{ steps.hashes.outputs.octobot_macos_x64_hash }} | + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./OctoBot_windows_x64.exe + asset_name: OctoBot_windows_x64.exe + asset_content_type: application/x-binary + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./OctoBot_linux_x64 + asset_name: OctoBot_linux_x64 + asset_content_type: application/x-binary + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./OctoBot_linux_arm64 + asset_name: OctoBot_linux_arm64 + asset_content_type: application/x-binary + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./OctoBot_macos_x64 + asset_name: OctoBot_macos_x64 + asset_content_type: application/x-binary notify: name: Notify