release #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Expects secrets: | |
# GITHUB_TOKEN - token for the repository, provided in GitHub Action | |
# HOMEBREW_TAP_GITHUB_TOKEN - token for the homebrew tap repository, must be set | |
# AUR_KEY - key for the AUR repository, must be set | |
# NUR_PACKAGES_GITHUB_TOKEN - token for the NUR packages repository, must be set | |
name: release | |
on: | |
create: | |
tags: | |
- v* | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: write | |
env: | |
CHOCOLATEY_VERSION: 2.2.2 | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v23 | |
- name: Install Snapcraft & Chocolatey | |
# from https://github.com/twpayne/chezmoi/blob/5293b40b48e678c461d68d06b635010173cac970/.github/workflows/main.yml#L154C1-L167C38 | |
run: | | |
sudo apt-get --quiet update | |
sudo apt-get --no-install-suggests --no-install-recommends --quiet --yes install musl-tools snapcraft | |
# https://github.com/goreleaser/goreleaser/issues/1715 | |
# https://bugs.launchpad.net/snapcraft/+bug/1889741 | |
mkdir -p "${HOME}/.cache/snapcraft/download" | |
mkdir -p "${HOME}/.cache/snapcraft/stage-packages" | |
mkdir -p /opt/chocolatey | |
wget -q -O - "https://github.com/chocolatey/choco/releases/download/${CHOCOLATEY_VERSION}/chocolatey.v${CHOCOLATEY_VERSION}.tar.gz" | tar -xz -C "/opt/chocolatey" | |
echo '#!/bin/bash' >> /usr/local/bin/choco | |
echo 'mono /opt/chocolatey/choco.exe $@' >> /usr/local/bin/choco | |
chmod +x /usr/local/bin/choco | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Run gofmt | |
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} | |
AUR_KEY: ${{ secrets.AUR_KEY }} | |
NUR_PACKAGES_GITHUB_TOKEN: ${{ secrets.NUR_PACKAGES_GITHUB_TOKEN }} | |
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }} |