diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2e49f26..545b962 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,12 +6,65 @@ on: - "v*.*.*" jobs: - build: - strategy: - matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest"] - runs-on: ${{ matrix.os }} - + Release-on-Windows: + name: Release on Windows + runs-on: windows-latest + steps: + - name: Install V + uses: vlang/setup-v@v1 + with: + check-latest: true + + - name: Install Task + uses: arduino/setup-task@v1 + + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@v2 + + - name: Install deps + run: task setup + + - name: Build ${{ github.event.repository.name }} + run: task dist + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + dist/** + + Release-on-Ubuntu: + name: Release on Windows + runs-on: ubuntu-latest + steps: + - name: Install V + uses: vlang/setup-v@v1 + with: + check-latest: true + + - name: Install Task + uses: arduino/setup-task@v1 + + - name: Checkout ${{ github.event.repository.name }} + uses: actions/checkout@v2 + + - name: Install deps + run: task setup + + - name: Build ${{ github.event.repository.name }} + run: task dist + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + dist/** + + Release-on-Darwin: + name: Release on Windows + runs-on: macos-latest steps: - name: Install V uses: vlang/setup-v@v1 diff --git a/.gitignore b/.gitignore index c08d6b5..039daa4 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,6 @@ vls.log # generated test files index.html -example/dist/ \ No newline at end of file +example/dist/ + +dist/ \ No newline at end of file diff --git a/Taskfile.yml b/Taskfile.yml index abcdb0e..fcd8583 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -2,10 +2,19 @@ version: '3' -env: +vars: TARGET: vss +includes: + build: ./misc/Taskfile_{{OS}}.yml + tasks: + + echo: + cmds: + - echo {{.ARCHIVE_DIR}} + vars: + ARCHIVE_DIR: "{{.TARGET}}_{{OS}}_{{ARCH}}" setup: desc: Setup vss project @@ -41,14 +50,14 @@ tasks: dist: desc: Mkdir dist cmds: - - mkdir -p dist + - task: clean - task: build - - cp $TARGET dist/ + - task build:archive build: desc: Build vss cmds: - - v . -o $TARGET + - v . -o {{.TARGET}} example: desc: Setup for example diff --git a/misc/Taskfile_darwin.yml b/misc/Taskfile_darwin.yml new file mode 100644 index 0000000..470e344 --- /dev/null +++ b/misc/Taskfile_darwin.yml @@ -0,0 +1,18 @@ +# https://taskfile.dev + +version: '3' + +vars: + TARGET: vss + +tasks: + archive: + desc: Create archive file + vars: + ARCHIVE_DIR: "dist/{{.TARGET}}_{{OS}}_{{ARCH}}" + cmds: + - mkdir -p dist + - mkdir -p {{.ARCHIVE_DIR}} + - mv {{.TARGET}} {{.ARCHIVE_DIR}} + - tar -zcvf {{.ARCHIVE_DIR}}.tar.gz {{.ARCHIVE_DIR}} + - rm -rf {{.ARCHIVE_DIR}} \ No newline at end of file diff --git a/misc/Taskfile_linux.yml b/misc/Taskfile_linux.yml new file mode 100644 index 0000000..3993f27 --- /dev/null +++ b/misc/Taskfile_linux.yml @@ -0,0 +1,18 @@ +# https://taskfile.dev + +version: '3' + +vars: + TARGET: vss + +tasks: + archive: + desc: Create archive file + vars: + ARCHIVE_DIR: "dist/{{.TARGET}}_{{OS}}_{{ARCH}}" + cmds: + - mkdir -p dist + - mkdir -p {{.ARCHIVE_DIR}} + - mv {{.TARGET}} {{.ARCHIVE_DIR}} + - tar -zcvf {{.ARCHIVE_DIR}}.tar.gz {{.ARCHIVE_DIR}} + - rm -rf {{.ARCHIVE_DIR}} diff --git a/misc/Taskfile_windows.yml b/misc/Taskfile_windows.yml new file mode 100644 index 0000000..7a55ae0 --- /dev/null +++ b/misc/Taskfile_windows.yml @@ -0,0 +1,18 @@ +# https://taskfile.dev + +version: '3' + +vars: + TARGET: vss + +tasks: + archive: + desc: Create archive file for windows + vars: + ARCHIVE_DIR: "dist/{{.TARGET}}_{{OS}}_{{ARCH}}" + cmds: + - mkdir -p dist + - mkdir -p {{.ARCHIVE_DIR}} + - mv {{.TARGET}} {{.ARCHIVE_DIR}} + - zip -r {{.ARCHIVE_DIR}}.tar.gz {{.ARCHIVE_DIR}} + - rm -rf {{.ARCHIVE_DIR}} \ No newline at end of file