github: enable run goreleaser automatically when bump new tag

Change-Id: Ieedeb07dcacf8ff7e6ae58a86c7072af0caf3f78
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/4781
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..5120d99
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,23 @@
+name: Release
+
+on:
+  push:
+    tags:
+      - 'v*'
+
+jobs:
+  goreleaser:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Checkout code
+      uses: actions/checkout@v2
+
+    - name: Unshallow  # required for the changelog to work correctly.
+      run: git fetch --prune --unshallow
+
+    - name: Run GoReleaser
+      uses: docker://goreleaser/goreleaser:latest
+      with:
+        args: release --rm-dist
+      env:
+        GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 7756297..34351ff 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,6 +1,13 @@
-on: [push, pull_request]
 name: Test
 
+on:
+  push:
+    branches:
+      - '*'
+    tags-ignore:
+      - 'v*'
+  pull_request:
+
 jobs:
   test:
     strategy:
diff --git a/.goreleaser.yml b/.goreleaser.yml
index 15fb67a..9b90e3a 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -1,11 +1,9 @@
-# This is an example goreleaser.yaml file with some sane defaults.
-# Make sure to check the documentation at http://goreleaser.com
+project_name: cue
+
 before:
   hooks:
     - go mod download
-    # you may remove this if you don't need go generate
-    - go generate ./...
-    - go fmt ./...
+
 builds:
 - env:
   - CGO_ENABLED=0
@@ -43,6 +41,9 @@
     - goos: windows
       format: zip
 
+release:
+  disable: false
+
 checksum:
   name_template: 'checksums.txt'