From 6a99f7a1f0213c9a21eee3c20429fa021cd7f1de Mon Sep 17 00:00:00 2001 From: Abid Mehmood Date: Tue, 25 May 2021 07:34:36 +0200 Subject: [PATCH] Create release.yml Add a GitHub action to build a release automatically when a tag is pushed. --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d564c8b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release + +on: + push: + tags: + - 'v*' +jobs: + + build: + name: Build + runs-on: ubuntu-latest + env: + GOPATH: ${{ github.workspace }} + GO111MODULE: off + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.12.x + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ./src/github.com/${{ github.repository }} + - name: Build + run: go build + working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} + - name: Package + run: tar cvzf inter-server-sync-linux-amd64.tar.gz inter-server-sync README.md + working-directory: ${{ github.workspace }}/src/github.com/${{ github.repository }} + - name: Create a Release + uses: actions/create-release@v1 + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./src/github.com/${{ github.repository }}/inter-server-sync-linux-amd64.tar.gz + asset_name: inter-server-sync-linux-amd64.tar.gz + asset_content_type: application/gzip +