diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a6e4770..9ea6609 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,21 +28,6 @@ jobs: - name: Install OpenCL run: .\fetch-opencl-dev-win.cmd x64 - # - name: dir pf - # run: cd C:\"Program Files" && dir - - # - name: dir pf x86 - # run: cd C:\"Program Files (x86)" && dir - - # - name: dir VS - # run: cd C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0" && dir - - # - name: dir VC - # run: cd C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\2022 && dir - - # - name: Set VS Path - # run: C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\VC\vcvarsall.bat x64 - - name: Build id: build_script run: .\make.cmd @@ -56,3 +41,50 @@ jobs: with: path: | clinfo.exe + + release: + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + + runs-on: ubuntu-latest + + needs: + - windows + + steps: + - name: Download artifacts + id: download-artifact + uses: actions/download-artifact@v3 + + - name: Get commit hash + id: commit + uses: pr-mpt/actions-commit-hash@v2 + + - name: Create release + id: create_release + uses: anzz1/action-create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }} + + - name: Upload release + id: upload_release + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const path = require('path'); + const fs = require('fs'); + const release_id = '${{ steps.create_release.outputs.id }}'; + for (let file of await fs.readdirSync('./artifact')) { + if (path.extname(file) === '.zip') { + console.log('uploadReleaseAsset', file); + await github.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release_id, + name: file, + data: await fs.readFileSync(`./artifact/${file}`) + }); + } + }