diff --git a/.github/workflows/go.yml b/.github/workflows/build.yml similarity index 96% rename from .github/workflows/go.yml rename to .github/workflows/build.yml index 201b957..a0c6c87 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Go +name: Build hello-web on: push: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..71eb198 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release hello-web + +on: + push: + tags: + - 'v*' + +jobs: + + build: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Build + run: CGO_ENABLED=0 go build -ldflags "-s -w" + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./hello-web + asset_name: hello-web + asset_content_type: application/x-executable +