From 287547b69efaadd5d75df467bf29e37500049a7a Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Tue, 3 Nov 2020 17:11:59 +0300 Subject: [PATCH] add github actions workflow --- .github/workflows/binary-release.yml | 118 +++++++++++++++++++++++++++ .github/workflows/build.yml | 23 ++++++ 2 files changed, 141 insertions(+) create mode 100644 .github/workflows/binary-release.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/binary-release.yml b/.github/workflows/binary-release.yml new file mode 100644 index 0000000..f957d35 --- /dev/null +++ b/.github/workflows/binary-release.yml @@ -0,0 +1,118 @@ +name: binary release + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + + - name: checkout + uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.13.0' + + - name: Build + run: make -j $(nproc) compile VERSION=${{ steps.get_version.outputs.VERSION }} + + - name: create release + id: create_release + uses: actions/create-release@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.get_version.outputs.VERSION }} + release_name: Release ${{ steps.get_version.outputs.VERSION }} + draft: false + prerelease: false + + - name: darwin-386 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/${{ github.event.repository.name }}-darwin-386 + asset_name: ${{ github.event.repository.name }}-darwin-386 + asset_content_type: application/octet-stream + + - name: darwin-amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/${{ github.event.repository.name }}-darwin-amd64 + asset_name: ${{ github.event.repository.name }}-darwin-amd64 + asset_content_type: application/octet-stream + + - name: freebsd-386 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/${{ github.event.repository.name }}-freebsd-386 + asset_name: ${{ github.event.repository.name }}-freebsd-386 + asset_content_type: application/octet-stream + + - name: freebsd-amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/${{ github.event.repository.name }}-freebsd-amd64 + asset_name: ${{ github.event.repository.name }}-freebsd-amd64 + asset_content_type: application/octet-stream + + - name: linux-386 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/${{ github.event.repository.name }}-linux-386 + asset_name: ${{ github.event.repository.name }}-linux-386 + asset_content_type: application/octet-stream + + - name: linux-amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/${{ github.event.repository.name }}-linux-amd64 + asset_name: ${{ github.event.repository.name }}-linux-amd64 + asset_content_type: application/octet-stream + + - name: windows-386 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/${{ github.event.repository.name }}-windows-386.exe + asset_name: ${{ github.event.repository.name }}-windows-386.exe + asset_content_type: application/octet-stream + + - name: windows-amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./bin/${{ github.event.repository.name }}-windows-amd64.exe + asset_name: ${{ github.event.repository.name }}-windows-amd64.exe + asset_content_type: application/octet-stream + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bfafbeb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,23 @@ +name: build + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: '1.13.0' + + - name: Build + run: make -j $(nproc) +