Release #11
Workflow file for this run
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
name: Release | |
on: | |
release: | |
types: [created] | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Update version | |
run: | | |
DATE=$(date -u +"%Y-%m-%d") | |
sed -i "s/const Version = \".*\"/const Version = \"${GITHUB_REF_NAME}\"/" pkg/version/version.go | |
sed -i "s/const Revision = \".*\"/const Revision = \"${GITHUB_SHA}\"/" pkg/version/version.go | |
sed -i "s/const Date = \".*\"/const Date = \"${DATE}\"/" pkg/version/version.go | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add pkg/version/version.go | |
git commit -m "Update version to ${GITHUB_REF_NAME}" | |
git push origin main | |
goreleaser: | |
needs: update-version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.20.0' | |
- name: Install Cosign | |
uses: sigstore/[email protected] | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: v2.4.7 | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COSIGN_EXPERIMENTAL: 1 | |
publish-aur: | |
needs: [goreleaser] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate PKGBUILD | |
run: | | |
# Remove 'v' prefix from version number for pkgver | |
VERSION="${GITHUB_REF_NAME}" | |
VERSION_NO_V=$(echo "$VERSION" | sed 's/^v//') | |
echo "Building package for version: $VERSION_NO_V" | |
cat > PKGBUILD << EOF | |
# Maintainer: Chris Watson <[email protected]> | |
pkgname=goshot-bin | |
pkgver=${VERSION_NO_V} | |
pkgrel=1 | |
pkgdesc="A powerful CLI tool and library for creating beautiful code screenshots with customizable window chrome, syntax highlighting, and backgrounds" | |
arch=('x86_64' 'aarch64') | |
url="https://github.com/watzon/goshot" | |
license=('MIT') | |
optdepends=( | |
'wl-clipboard: clipboard support for Wayland' | |
'xclip: clipboard support for X11' | |
) | |
provides=('goshot') | |
conflicts=('goshot') | |
source_x86_64=("goshot_Linux_x86_64.tar.gz::https://github.com/watzon/goshot/releases/download/v\${pkgver}/goshot_Linux_x86_64.tar.gz") | |
source_aarch64=("goshot_Linux_arm64.tar.gz::https://github.com/watzon/goshot/releases/download/v\${pkgver}/goshot_Linux_arm64.tar.gz") | |
sha256sums_x86_64=('SKIP') | |
sha256sums_aarch64=('SKIP') | |
package() { | |
cd "\$srcdir" | |
install -Dm755 goshot "\$pkgdir/usr/bin/goshot" | |
install -Dm644 LICENSE "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE" | |
} | |
EOF | |
- name: Publish AUR package | |
uses: KSXGitHub/[email protected] | |
with: | |
pkgname: goshot-bin | |
pkgbuild: ./PKGBUILD | |
commit_username: ${{ secrets.AUR_USERNAME }} | |
commit_email: ${{ secrets.AUR_EMAIL }} | |
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
commit_message: "Update to version ${GITHUB_REF#refs/tags/v}" |