diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93c2fff..cbc7fec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -57,12 +57,25 @@ jobs: env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_TOKEN }} + - name: Prepare extra command for goreleaser + id: prepare_goreleaser_extra_commands + run: | + set -x + EXTRA_GORELEASER_COMMANDS="" + + TAG=${{ github.ref | replace('refs/tags/', '') }} + if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + EXTRA_GORELEASER_COMMANDS="-f .goreleaser_announce.yml ${EXTRA_GORELEASER_COMMANDS}" + fi + + echo "EXTRA_GORELEASER_COMMANDS=${EXTRA_GORELEASER_COMMANDS}" >> $GITHUB_OUTPUT + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser-pro version: "~> v2" - args: release --clean -f ${{ vars.GORELEASER_CONFIG_PATH }} + args: release --clean -f ${{ vars.GORELEASER_CONFIG_PATH }} ${{ steps.prepare_goreleaser_extra_commands.outputs.EXTRA_GORELEASER_COMMANDS }} env: AUR_KEY: ${{ secrets.AUR_KEY }} GITHUB_TOKEN: ${{ secrets.TENV_GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 351a2c0..7e970be 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,23 +1,6 @@ project_name: tenv version: 2 -announce: - slack: - enabled: true - message_template: ":tada: tenv {{.Tag}} is available! See what's new here - https://github.com/tofuutils/tenv/releases/tag/{{.Tag}}" - channel: "#tofuutils" - username: "tofuutils-notifications" - icon_emoji: "" - icon_url: "" - blocks: [] - attachments: [] - - telegram: - enabled: true - chat_id: -4020097127 - message_template: "🎉 tenv {{.Tag}} is available! See what's new here - https://github.com/tofuutils/tenv/releases/tag/{{.Tag}}" - parse_mode: HTML - before: hooks: - go mod tidy diff --git a/.goreleaser_announce.yml b/.goreleaser_announce.yml new file mode 100644 index 0000000..37bc4ed --- /dev/null +++ b/.goreleaser_announce.yml @@ -0,0 +1,16 @@ +announce: + slack: + enabled: true + message_template: ":tada: tenv {{.Tag}} is available! See what's new here - https://github.com/tofuutils/tenv/releases/tag/{{.Tag}}" + channel: "#tofuutils" + username: "tofuutils-notifications" + icon_emoji: "" + icon_url: "" + blocks: [] + attachments: [] + + telegram: + enabled: true + chat_id: -4020097127 + message_template: "🎉 tenv {{ mdv2escape .Tag}} is available{{ mdv2escape '!' }} See what is new here - https://github.com/tofuutils/tenv/releases/tag/{{ mdv2escape .Tag}}" + parse_mode: HTML