diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06823f4e4..f38794818 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,10 +90,10 @@ jobs: - name: Snapcraft Login if: startsWith(github.ref, 'refs/tags/v') - run: | - snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_LOGIN }}") + run: snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_LOGIN }}") - name: GoReleaser + if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' env: GITHUB_TOKEN: ${{ secrets.GH_PAT }} TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} @@ -104,9 +104,4 @@ jobs: FURY_TOKEN: ${{ secrets.FURY_TOKEN }} DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }} DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} - run: | - if [[ $GITHUB_REF == refs/tags/v* ]]; then - ./goreleaser - elif [[ $GITHUB_REF == refs/heads/master ]]; then - ./goreleaser --snapshot - fi + run: task goreleaser diff --git a/.gitignore b/.gitignore index 60fbdc3ab..de753ddc7 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ www/docs/static/releases*.json .vercel completions/ .vscode/ +.task/ diff --git a/Taskfile.yml b/Taskfile.yml index c522a5117..4f3dc0ed3 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -22,6 +22,10 @@ tasks: build: desc: Build the binary + sources: + - ./**/*.go + generates: + - ./goreleaser cmds: - go build @@ -72,3 +76,23 @@ tasks: cmds: - scripts/vercel/install.sh - scripts/vercel/build.sh + + release: + desc: Create a new tag + vars: + NEXT: + sh: svu n + cmds: + - git tag {{.NEXT}} + - echo {{.NEXT}} + - git push origin --tags + + goreleaser: + desc: Run GoReleaser either in snapshot or release mode + deps: + - build + vars: + SNAPSHOT: + sh: 'if [[ $GITHUB_REF != refs/tags/v* ]]; then echo "--snapshot"; fi' + cmds: + - ./goreleaser release --rm-dist {{.SNAPSHOT}}