Skip to content

Commit

Permalink
added releases to github
Browse files Browse the repository at this point in the history
  • Loading branch information
biw committed Jul 28, 2023
1 parent 7b7734c commit a0ffb67
Showing 1 changed file with 47 additions and 15 deletions.
62 changes: 47 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}`)
});
}
}

0 comments on commit a0ffb67

Please sign in to comment.