CI #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
os_name: linux | |
exe_name: KodularStarter_linux | |
- os: windows-latest | |
os_name: windows | |
exe_name: KodularStarter_windows.exe | |
- os: macOS-latest | |
os_name: macos | |
exe_name: KodularStarter_macos | |
name: Build on ${{ matrix.os_name }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up V version latest | |
uses: nocturlab/setup-vlang-action@master | |
with: | |
v-version: latest | |
- name: Embed files | |
env: | |
OS_NAME: ${{ matrix.os_name }} | |
# run: v bin2v -w $OS_NAME ../ext/adb/$OS_NAME/* # uncommenent when vlang/v#7690 is fixed | |
run: | | |
cd ext/adb/$OS_NAME | |
v bin2v * > ../../../binary/windows.v | |
- name: Build executable | |
env: | |
EXE_NAME: ${{ matrix.exe_name }} | |
run: | | |
mkdir out | |
v -prod -o out/$EXE_NAME . | |
- name: Set metadata to exe | |
if: matrix.os_name == 'windows' | |
env: | |
EXE_NAME: ${{ matrix.exe_name }} | |
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" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.exe_name }} | |
path: out/${{ matrix.exe_name }} | |
release: | |
name: Create GitHub release | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Get short tag name | |
uses: jungwinter/split@v1 | |
id: split | |
with: | |
msg: ${{ github.ref }} | |
seperator: / | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ steps.split.outputs._2 }} | |
draft: true | |
prerelease: false | |
publish: | |
name: Publish | |
needs: release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
exe_name: [KodularStarter_linux, KodularStarter_windows.exe, KodularStarter_macos] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Fetch artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ matrix.exe_name }} | |
- name: Set executable bit | |
if: endsWith(matrix.exe_name, '.exe') == false | |
run: chmod +x ./${{ matrix.exe_name }} | |
- name: Upload release binary | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./${{ matrix.exe_name }} | |
asset_name: ${{ matrix.exe_name }} | |
asset_content_type: application/octet-stream |