diff --git a/.github/workflows/go.yml b/.github/workflows/build.yml similarity index 92% rename from .github/workflows/go.yml rename to .github/workflows/build.yml index 033ea02..c833d02 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: run: | export GO111MODULE=on GOOS=linux go build -o main - # zip bin/release.zip bin/main + zip deployment.zip main - name: Archive Artifacts uses: actions/upload-artifact@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6509ce6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Release Asset + +jobs: + build: + name: Release Asset + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v1 + + - name: Build + run: | + export GO111MODULE=on + GOOS=linux go build -o main + zip deployment.zip main + + - name: Create Release + id: create_release + uses: actions/create-release@v1.0.0 + 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.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./deployments.zip + asset_name: deployments.zip + asset_content_type: application/zip \ No newline at end of file