Moved GIFs -> dssh-artifacts repo #4
Workflow file for this run
This file contains hidden or 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: AUR Publish | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to publish (e.g. v2.1.1)' | |
| required: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| if: github.server_url == 'https://github.com' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Resolve version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| TAG="${{ inputs.tag }}" | |
| else | |
| TAG="${GITHUB_REF_NAME}" | |
| fi | |
| PKGVER="${TAG#v}" | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| echo "pkgver=$PKGVER" >> "$GITHUB_OUTPUT" | |
| - name: Wait for tarball & compute sha256 | |
| id: sha | |
| run: | | |
| URL="https://github.com/madLinux7/dssh/archive/${{ steps.version.outputs.tag }}.tar.gz" | |
| for i in 1 2 3 4 5; do | |
| if curl -fsSL "$URL" -o src.tar.gz; then | |
| break | |
| fi | |
| echo "Tarball not ready, retry $i/5..." | |
| sleep 10 | |
| done | |
| SHA=$(sha256sum src.tar.gz | awk '{print $1}') | |
| echo "sha256=$SHA" >> "$GITHUB_OUTPUT" | |
| - name: Setup SSH for AUR | |
| run: | | |
| mkdir -p ~/.ssh | |
| chmod 700 ~/.ssh | |
| printf '%s\n' "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/aur | |
| chmod 600 ~/.ssh/aur | |
| ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null | |
| cat > ~/.ssh/config <<EOF | |
| Host aur.archlinux.org | |
| User aur | |
| IdentityFile ~/.ssh/aur | |
| IdentitiesOnly yes | |
| StrictHostKeyChecking yes | |
| EOF | |
| chmod 600 ~/.ssh/config | |
| - name: Clone AUR repo | |
| run: git clone ssh://aur@aur.archlinux.org/dssh.git aur-repo | |
| - name: Render PKGBUILD & .SRCINFO | |
| env: | |
| PKGVER: ${{ steps.version.outputs.pkgver }} | |
| SHA256: ${{ steps.sha.outputs.sha256 }} | |
| run: | | |
| cat > aur-repo/PKGBUILD <<EOF | |
| # Maintainer: Linus Grolmes <linus@grolmes.de> | |
| pkgname=dssh | |
| pkgver=${PKGVER} | |
| pkgrel=1 | |
| pkgdesc="The only SSH connection manager you'll ever need. CLI & TUI." | |
| arch=('x86_64' 'aarch64') | |
| url="https://github.com/madLinux7/dssh" | |
| license=('MIT') | |
| makedepends=('go') | |
| depends=('openssh') | |
| source=("\$pkgname-\$pkgver.tar.gz::https://github.com/madLinux7/dssh/archive/v\$pkgver.tar.gz") | |
| sha256sums=('${SHA256}') | |
| build() { | |
| cd "\$pkgname-\$pkgver" | |
| export CGO_ENABLED=0 | |
| go build -ldflags="-s -w -X main.version=v\$pkgver" -o dssh ./cmd/dssh/ | |
| } | |
| package() { | |
| cd "\$pkgname-\$pkgver" | |
| install -Dm755 dssh "\$pkgdir/usr/bin/dssh" | |
| install -Dm644 LICENSE "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE" | |
| } | |
| EOF | |
| cat > aur-repo/.SRCINFO <<EOF | |
| pkgbase = dssh | |
| pkgdesc = The only SSH connection manager you'll ever need. CLI & TUI. | |
| pkgver = ${PKGVER} | |
| pkgrel = 1 | |
| url = https://github.com/madLinux7/dssh | |
| arch = x86_64 | |
| arch = aarch64 | |
| license = MIT | |
| makedepends = go | |
| depends = openssh | |
| source = dssh-${PKGVER}.tar.gz::https://github.com/madLinux7/dssh/archive/v${PKGVER}.tar.gz | |
| sha256sums = ${SHA256} | |
| pkgname = dssh | |
| EOF | |
| - name: Commit & push | |
| working-directory: aur-repo | |
| env: | |
| TAG: ${{ steps.version.outputs.tag }} | |
| run: | | |
| git config user.name "Linus Grolmes" | |
| git config user.email "linus@grolmes.de" | |
| git add PKGBUILD .SRCINFO | |
| if git diff --cached --quiet; then | |
| echo "No changes to publish" | |
| exit 0 | |
| fi | |
| git commit -m "[ci] Update to ${TAG}" | |
| git push |