|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + pull_request: |
| 9 | + branches: [master] |
| 10 | + |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - os: ubuntu-latest |
| 19 | + os_name: linux |
| 20 | + exe_name: KodularStarter_linux |
| 21 | + - os: windows-latest |
| 22 | + os_name: windows |
| 23 | + exe_name: KodularStarter_windows.exe |
| 24 | + - os: macOS-latest |
| 25 | + os_name: macos |
| 26 | + exe_name: KodularStarter_macos |
| 27 | + |
| 28 | + name: Build on ${{ matrix.os_name }} |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + |
| 31 | + defaults: |
| 32 | + run: |
| 33 | + shell: bash |
| 34 | + |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v2 |
| 37 | + |
| 38 | + - name: Set up V version latest |
| 39 | + uses: nocturlab/setup-vlang-action@master |
| 40 | + with: |
| 41 | + v-version: latest |
| 42 | + |
| 43 | + - name: Embed files |
| 44 | + env: |
| 45 | + OS_NAME: ${{ matrix.os_name }} |
| 46 | + # run: v bin2v -w $OS_NAME ../ext/adb/$OS_NAME/* # uncommenent when vlang/v#7690 is fixed |
| 47 | + run: | |
| 48 | + cd ext/adb/$OS_NAME |
| 49 | + v bin2v * > ../../../binary/windows.v |
| 50 | +
|
| 51 | + - name: Build executable |
| 52 | + env: |
| 53 | + EXE_NAME: ${{ matrix.exe_name }} |
| 54 | + run: | |
| 55 | + mkdir out |
| 56 | + v -prod -o out/$EXE_NAME . |
| 57 | +
|
| 58 | + - name: Set metadata to exe |
| 59 | + if: matrix.os_name == 'windows' |
| 60 | + env: |
| 61 | + EXE_NAME: ${{ matrix.exe_name }} |
| 62 | + run: ./ext/rcedit-x64.exe "out/$EXE_NAME" --set-icon icon.ico --set-file-version 2 --set-product-version 2 --set-version-string "ProductName" "Kodular Starter" |
| 63 | + |
| 64 | + - uses: actions/upload-artifact@v2 |
| 65 | + with: |
| 66 | + name: ${{ matrix.exe_name }} |
| 67 | + path: out/${{ matrix.exe_name }} |
| 68 | + |
| 69 | + release: |
| 70 | + name: Create GitHub release |
| 71 | + needs: build |
| 72 | + runs-on: ubuntu-latest |
| 73 | + |
| 74 | + if: startsWith(github.ref, 'refs/tags/v') |
| 75 | + |
| 76 | + outputs: |
| 77 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 78 | + |
| 79 | + steps: |
| 80 | + - name: Get short tag name |
| 81 | + uses: jungwinter/split@v1 |
| 82 | + id: split |
| 83 | + with: |
| 84 | + msg: ${{ github.ref }} |
| 85 | + seperator: / |
| 86 | + |
| 87 | + - name: Create Release |
| 88 | + id: create_release |
| 89 | + uses: actions/create-release@v1 |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + with: |
| 93 | + tag_name: ${{ github.ref }} |
| 94 | + release_name: Release ${{ steps.split.outputs._2 }} |
| 95 | + draft: true |
| 96 | + prerelease: false |
| 97 | + |
| 98 | + publish: |
| 99 | + name: Publish |
| 100 | + needs: release |
| 101 | + runs-on: ubuntu-latest |
| 102 | + |
| 103 | + strategy: |
| 104 | + matrix: |
| 105 | + exe_name: [KodularStarter_linux, KodularStarter_windows.exe, KodularStarter_macos] |
| 106 | + |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v2 |
| 109 | + |
| 110 | + - name: Fetch artifacts |
| 111 | + uses: actions/download-artifact@v2 |
| 112 | + with: |
| 113 | + name: ${{ matrix.exe_name }} |
| 114 | + |
| 115 | + - name: Set executable bit |
| 116 | + if: endsWith(matrix.exe_name, '.exe') == false |
| 117 | + run: chmod +x ./${{ matrix.exe_name }} |
| 118 | + |
| 119 | + - name: Upload release binary |
| 120 | + uses: actions/upload-release-asset@v1.0.2 |
| 121 | + env: |
| 122 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 123 | + with: |
| 124 | + upload_url: ${{ needs.release.outputs.upload_url }} |
| 125 | + asset_path: ./${{ matrix.exe_name }} |
| 126 | + asset_name: ${{ matrix.exe_name }} |
| 127 | + asset_content_type: application/octet-stream |
0 commit comments