💚 Update: Release Script

This commit is contained in:
zztkm 2022-08-05 13:54:09 +09:00
parent 612ccae092
commit 1650b097f9
6 changed files with 129 additions and 11 deletions

View file

@ -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

4
.gitignore vendored
View file

@ -10,4 +10,6 @@ vls.log
# generated test files
index.html
example/dist/
example/dist/
dist/

View file

@ -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

18
misc/Taskfile_darwin.yml Normal file
View file

@ -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}}

18
misc/Taskfile_linux.yml Normal file
View file

@ -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}}

18
misc/Taskfile_windows.yml Normal file
View file

@ -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}}