Skip to content

Completion Improvement #202

Completion Improvement

Completion Improvement #202

Workflow file for this run

name: pull-request binary
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
concurrency:
group: binary-pr-${{ github.ref }}
cancel-in-progress: true
jobs:
preprocess:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.result }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/github-script@v6
id: setmatrix
with:
result-encoding: string
script: |
const fs = require("fs");
file = fs.readFileSync('./.github/workflows/editme.json', "utf8");
return JSON.stringify(JSON.parse(file).binaries);
build:
name: ${{ matrix.name }}-${{ matrix.os }}-${{ matrix.arch }}-go${{ matrix.go }}
needs: preprocess
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{fromJson(needs.preprocess.outputs.matrix)}}
steps:
- name: set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
id: go
- name: checkout
uses: actions/checkout@v2
- name: download modules
if: steps.cache.outputs.cache-hit != 'true'
run: go mod download
- name: build
run: |
REPO=github.com/slankdev/vtyang
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} \
go build -o ${{ matrix.name }} -ldflags "\
-X $REPO/pkg/util.gitSHA=$(git rev-parse HEAD) \
-X $REPO/pkg/util.gitBranch=none \
-X $REPO/pkg/util.gitTag=$(git describe --tags --abbrev=0) \
-X $REPO/pkg/util.buildDate=$(date '+%Y/%m/%d-%H:%M:%S-%Z') \
" cmd/${{ matrix.name }}/main.go
- name: upload HEAD
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ matrix.name }}
asset_name: pr-${{ github.event.number }}.${{ matrix.name }}.${{ matrix.os }}-${{ matrix.arch }}.go${{ matrix.go }}
tag: branch-main
overwrite: true