diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1b2f485 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,60 @@ +name: Build/release + +on: + workflow_dispatch: + + push: + tags: + - "*" + +jobs: + release: + runs-on: macos-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: Install Node.js, NPM and Yarn + uses: actions/setup-node@v1 + with: + node-version: "16.x" + + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Install golang + uses: actions/setup-go@v2 + with: + go-version: "^1.17.6" + + - name: Build + run: | + go get + yarn build + + - name: Create archives + working-directory: ./dist + run: | + for i in *; do zip -r "${i%/}.zip" "$i"; done + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/*.zip + file_glob: true + tag: ${{ github.ref }} + overwrite: true