|
1 | 1 | name: CI
|
2 |
| -on: [push, pull_request] |
3 | 2 |
|
4 |
| -jobs: |
5 |
| - ubuntu-latest: |
6 |
| - runs-on: ubuntu-latest |
7 |
| - |
8 |
| - steps: |
9 |
| - - name: Clone |
10 |
| - uses: actions/checkout@v1 |
11 |
| - |
12 |
| - - name: Dependencies |
13 |
| - run: | |
14 |
| - sudo apt-get update |
15 |
| - sudo apt-get install build-essential |
16 |
| -
|
17 |
| - - name: Build |
18 |
| - run: | |
19 |
| - make |
20 |
| -
|
21 |
| - macOS-latest: |
22 |
| - runs-on: macOS-latest |
23 |
| - |
24 |
| - steps: |
25 |
| - - name: Clone |
26 |
| - uses: actions/checkout@v1 |
27 |
| - |
28 |
| - - name: Dependencies |
29 |
| - run: | |
30 |
| - brew update |
31 |
| -
|
32 |
| - - name: Build |
33 |
| - run: | |
34 |
| - make |
| 3 | +on: |
| 4 | + workflow_dispatch: # allows manual triggering |
| 5 | + inputs: |
| 6 | + create_release: |
| 7 | + description: 'Create new release' |
| 8 | + required: true |
| 9 | + type: boolean |
| 10 | + push: |
| 11 | + paths: ['.github/workflows/**', 'CMakeLists.txt', 'Makefile', '**.h', '*.c', '**.cpp'] |
| 12 | + pull_request: |
| 13 | + types: [opened, synchronize, edited, reopened, review_requested, ready_for_review] |
| 14 | + paths: ['CMakeLists.txt', 'Makefile', '**.h', '*.c', '**.cpp'] |
35 | 15 |
|
| 16 | +jobs: |
| 17 | +# ubuntu-latest: |
| 18 | +# runs-on: ubuntu-latest |
| 19 | +# |
| 20 | +# steps: |
| 21 | +# - name: Clone |
| 22 | +# uses: actions/checkout@v1 |
| 23 | +# |
| 24 | +# - name: Dependencies |
| 25 | +# run: | |
| 26 | +# sudo apt-get update |
| 27 | +# sudo apt-get install build-essential |
| 28 | +# |
| 29 | +# - name: Build |
| 30 | +# run: | |
| 31 | +# make |
| 32 | +# |
| 33 | +# macOS-latest: |
| 34 | +# runs-on: macOS-latest |
| 35 | +# |
| 36 | +# steps: |
| 37 | +# - name: Clone |
| 38 | +# uses: actions/checkout@v1 |
| 39 | +# |
| 40 | +# - name: Dependencies |
| 41 | +# run: | |
| 42 | +# brew update |
| 43 | +# |
| 44 | +# - name: Build |
| 45 | +# run: | |
| 46 | +# make |
| 47 | +# |
36 | 48 | windows-latest:
|
37 | 49 | runs-on: windows-latest
|
38 | 50 |
|
39 | 51 | steps:
|
40 | 52 | - name: Clone
|
| 53 | + id: checkout |
41 | 54 | uses: actions/checkout@v1
|
42 | 55 |
|
43 | 56 | - name: Build
|
| 57 | + id: cmake_build |
44 | 58 | run: |
|
45 | 59 | mkdir build
|
46 | 60 | cd build
|
47 | 61 | cmake ..
|
48 | 62 | cmake --build . --config Release
|
49 | 63 |
|
| 64 | + - name: Set commit hash variables |
| 65 | + id: commit |
| 66 | + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} |
| 67 | + uses: pr-mpt/actions-commit-hash@v2 |
| 68 | + |
| 69 | + - name: Pack artifacts |
| 70 | + id: pack_artifacts |
| 71 | + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} |
| 72 | + run: | |
| 73 | + 7z a alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip .\build\Release\* |
| 74 | +
|
| 75 | + - name: Create release |
| 76 | + id: create_release |
| 77 | + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} |
| 78 | + uses: zendesk/action-create-release@v1 |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + with: |
| 82 | + tag_name: ${{ steps.commit.outputs.short }} |
| 83 | + |
| 84 | + - name: Upload release |
| 85 | + id: upload_release |
| 86 | + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} |
| 87 | + uses: actions/upload-release-asset@v1 |
| 88 | + env: |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + with: |
| 91 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 92 | + asset_path: .\alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip |
| 93 | + asset_name: alpaca-bin-win-x64-${{ steps.commit.outputs.short }}.zip |
| 94 | + asset_content_type: application/octet-stream |
| 95 | + |
50 | 96 | # ubuntu-latest-gcc:
|
51 | 97 | # runs-on: ubuntu-latest
|
52 | 98 | #
|
|
0 commit comments