Compare commits
12 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 76824346b8 | |||
| 7e7cf1cf65 | |||
| 55e4539bf7 | |||
| d5eaea9600 | |||
| 0a89020ce1 | |||
| e831dd1eb1 | |||
| e0394a0a0f | |||
| 1f42ba75f2 | |||
| 45ad565459 | |||
| b4afe150e8 | |||
| 8bbe2fbde8 | |||
| 5253514d4c |
5 changed files with 178 additions and 83 deletions
165
.forgejo/workflows/release.yml
Normal file
165
.forgejo/workflows/release.yml
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: rust:bookworm
|
||||||
|
volumes:
|
||||||
|
- /opt/runner/keys:/keys:ro
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y dpkg-dev git curl openssh-client
|
||||||
|
|
||||||
|
- name: Setup SSH
|
||||||
|
run: |
|
||||||
|
test -r /keys/forgejo_runner || { echo "Deploy key /keys/forgejo_runner chybi"; exit 1; }
|
||||||
|
install -m 600 /keys/forgejo_runner /tmp/forgejo_runner
|
||||||
|
echo "GIT_SSH_COMMAND=ssh -p 554 -i /tmp/forgejo_runner -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Checkout source
|
||||||
|
run: |
|
||||||
|
git clone ssh://git@git-ssh.janvete.com:554/seth/resticview.git src
|
||||||
|
cd src
|
||||||
|
git checkout "${{ github.ref_name }}"
|
||||||
|
|
||||||
|
- name: Build Linux release binary and .deb
|
||||||
|
working-directory: src
|
||||||
|
run: |
|
||||||
|
VERSION=${{ github.ref_name }}
|
||||||
|
VER=${VERSION#v}
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
# .deb package
|
||||||
|
DEB_DIR="resticview_${VER}_amd64"
|
||||||
|
mkdir -p "${DEB_DIR}/DEBIAN" "${DEB_DIR}/usr/bin"
|
||||||
|
cp target/release/resticview "${DEB_DIR}/usr/bin/resticview"
|
||||||
|
chmod 755 "${DEB_DIR}/usr/bin/resticview"
|
||||||
|
|
||||||
|
cat > "${DEB_DIR}/DEBIAN/control" << CONTROL
|
||||||
|
Package: resticview
|
||||||
|
Version: ${VER}
|
||||||
|
Section: utils
|
||||||
|
Priority: optional
|
||||||
|
Architecture: amd64
|
||||||
|
Maintainer: janvete <jan.vete@example.com>
|
||||||
|
Description: TUI browser for restic backup repositories
|
||||||
|
CONTROL
|
||||||
|
|
||||||
|
dpkg-deb --build "${DEB_DIR}" "dist/${DEB_DIR}.deb"
|
||||||
|
|
||||||
|
# Linux tarball
|
||||||
|
STAGING=$(mktemp -d)
|
||||||
|
cp target/release/resticview "${STAGING}/resticview"
|
||||||
|
tar -czf "dist/resticview-${VERSION}-linux-amd64.tar.gz" -C "${STAGING}" resticview
|
||||||
|
rm -rf "${STAGING}"
|
||||||
|
|
||||||
|
- name: Print checksums
|
||||||
|
working-directory: src
|
||||||
|
run: |
|
||||||
|
echo "=== SHA256 checksums ==="
|
||||||
|
sha256sum dist/*
|
||||||
|
|
||||||
|
- name: Create Forgejo Release
|
||||||
|
working-directory: src
|
||||||
|
env:
|
||||||
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
|
FORGEJO_URL: https://git.janvete.com
|
||||||
|
run: |
|
||||||
|
VERSION=${{ github.ref_name }}
|
||||||
|
API="${FORGEJO_URL}/api/v1/repos/seth/resticview"
|
||||||
|
|
||||||
|
RELEASE_JSON=$(curl -sS -H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"${VERSION}\",\"draft\":false,\"prerelease\":false}" \
|
||||||
|
"${API}/releases")
|
||||||
|
|
||||||
|
echo "Create release response: ${RELEASE_JSON}"
|
||||||
|
RELEASE_ID=$(echo "${RELEASE_JSON}" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
|
||||||
|
if [ -z "${RELEASE_ID}" ]; then
|
||||||
|
echo "Release may already exist, fetching existing release..."
|
||||||
|
EXISTING=$(curl -sS -H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
|
"${API}/releases/tags/${VERSION}")
|
||||||
|
echo "Existing release response: ${EXISTING}"
|
||||||
|
RELEASE_ID=$(echo "${EXISTING}" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${RELEASE_ID}" ]; then
|
||||||
|
echo "Failed to create or fetch release"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for ARCHIVE in dist/*; do
|
||||||
|
[ -e "${ARCHIVE}" ] || continue
|
||||||
|
NAME=$(basename "${ARCHIVE}")
|
||||||
|
case "${NAME}" in
|
||||||
|
*.tar.gz) CONTENT_TYPE="application/gzip" ;;
|
||||||
|
*.deb) CONTENT_TYPE="application/vnd.debian.binary-package" ;;
|
||||||
|
*) CONTENT_TYPE="application/octet-stream" ;;
|
||||||
|
esac
|
||||||
|
curl -sS -H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
|
-H "Content-Type: ${CONTENT_TYPE}" \
|
||||||
|
--data-binary "@${ARCHIVE}" \
|
||||||
|
"${API}/releases/${RELEASE_ID}/assets?name=${NAME}"
|
||||||
|
echo "Uploaded ${NAME}"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Update APT repository
|
||||||
|
working-directory: src
|
||||||
|
run: |
|
||||||
|
VERSION=${{ github.ref_name }}
|
||||||
|
|
||||||
|
git clone ssh://git@git-ssh.janvete.com:554/seth/apt.git apt-repo
|
||||||
|
cp dist/*.deb apt-repo/
|
||||||
|
|
||||||
|
cd apt-repo
|
||||||
|
|
||||||
|
# Remove any corrupted .deb files left from previous failed runs
|
||||||
|
for f in *.deb; do
|
||||||
|
[ -e "$f" ] || continue
|
||||||
|
if ! dpkg-deb -I "$f" >/dev/null 2>&1; then
|
||||||
|
echo "Removing corrupted package: $f"
|
||||||
|
rm -f "$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
dpkg-scanpackages . > Packages
|
||||||
|
gzip -k -f Packages
|
||||||
|
|
||||||
|
cat > Release << RELEASE
|
||||||
|
Origin: janvete
|
||||||
|
Label: janvete
|
||||||
|
Suite: stable
|
||||||
|
Codename: stable
|
||||||
|
Version: 1.0
|
||||||
|
Architectures: amd64
|
||||||
|
Components: main
|
||||||
|
Description: janvete tools APT repository
|
||||||
|
Date: $(date -Ru)
|
||||||
|
RELEASE
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "SHA256:"
|
||||||
|
for f in Packages Packages.gz *.deb; do
|
||||||
|
[ -e "$f" ] || continue
|
||||||
|
printf " %s %16d %s\n" "$(sha256sum "$f" | cut -d' ' -f1)" "$(stat -c%s "$f")" "$f"
|
||||||
|
done
|
||||||
|
} >> Release
|
||||||
|
|
||||||
|
git config user.email "forgejo-actions[bot]@janvete.com"
|
||||||
|
git config user.name "forgejo-actions[bot]"
|
||||||
|
git add -A
|
||||||
|
git commit -m "chore: add resticview ${VERSION}"
|
||||||
|
git push
|
||||||
70
.github/workflows/release.yml
vendored
70
.github/workflows/release.yml
vendored
|
|
@ -1,70 +0,0 @@
|
||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: 'Tag to release (e.g. v0.1.6)'
|
|
||||||
required: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-macos:
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
|
||||||
- run: cargo build --release
|
|
||||||
- run: cargo test --release
|
|
||||||
- run: cargo clippy --release -- -D warnings
|
|
||||||
- run: cp target/release/resticview target/release/resticview-macos
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: resticview-macos
|
|
||||||
path: target/release/resticview-macos
|
|
||||||
|
|
||||||
build-linux:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
|
||||||
- run: cargo install cargo-deb
|
|
||||||
- run: cargo build --release
|
|
||||||
- run: cargo test --release
|
|
||||||
- run: cargo clippy --release -- -D warnings
|
|
||||||
- run: cargo deb
|
|
||||||
- run: cp target/release/resticview target/release/resticview-linux
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: resticview-linux
|
|
||||||
path: |
|
|
||||||
target/release/resticview-linux
|
|
||||||
target/debian/*.deb
|
|
||||||
|
|
||||||
release:
|
|
||||||
needs: [build-macos, build-linux]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: resticview-macos
|
|
||||||
path: artifacts/macos
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: resticview-linux
|
|
||||||
path: artifacts/linux
|
|
||||||
- name: Create Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
|
|
||||||
files: |
|
|
||||||
artifacts/macos/resticview-macos
|
|
||||||
artifacts/linux/release/resticview-linux
|
|
||||||
artifacts/linux/debian/*.deb
|
|
||||||
generate_release_notes: true
|
|
||||||
overwrite_files: true
|
|
||||||
|
|
@ -5,8 +5,8 @@ edition = "2024"
|
||||||
authors = ["janvete"]
|
authors = ["janvete"]
|
||||||
description = "TUI browser for restic backup repositories"
|
description = "TUI browser for restic backup repositories"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/janvete/resticview"
|
repository = "https://git.janvete.com/seth/resticview"
|
||||||
homepage = "https://github.com/janvete/resticview"
|
homepage = "https://git.janvete.com/seth/resticview"
|
||||||
keywords = ["cli", "tui", "restic", "backup"]
|
keywords = ["cli", "tui", "restic", "backup"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
class Resticview < Formula
|
class Resticview < Formula
|
||||||
desc "TUI browser for restic backup repositories"
|
desc "TUI browser for restic backup repositories"
|
||||||
homepage "https://github.com/janvete/resticview"
|
homepage "https://git.janvete.com/seth/resticview"
|
||||||
url "https://github.com/janvete/resticview/archive/refs/tags/v0.1.0.tar.gz"
|
url "https://git.janvete.com/seth/resticview/archive/v0.1.4.tar.gz"
|
||||||
sha256 "89aa460304da090dc7eb3b6bada06c91ad7bc72387b12c1fbbd11cf877726201"
|
sha256 "79de9f0e8ecac078094e457677c316c6f0a37ca87de36d82ec0723c283aaa4b2"
|
||||||
license "MIT"
|
license "MIT"
|
||||||
head "https://github.com/janvete/resticview.git", branch: "main"
|
head "https://git.janvete.com/seth/resticview.git", branch: "main"
|
||||||
|
|
||||||
depends_on "rust" => :build
|
depends_on "rust" => :build
|
||||||
|
|
||||||
|
|
|
||||||
14
README.md
14
README.md
|
|
@ -7,23 +7,23 @@ A TUI browser for restic backup repositories. Browse snapshots, explore the file
|
||||||
### macOS (Homebrew)
|
### macOS (Homebrew)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew tap janvete/tools
|
brew tap janvete/tools https://git.janvete.com/seth/homebrew-tools.git
|
||||||
brew install resticview
|
brew install resticview
|
||||||
```
|
```
|
||||||
|
|
||||||
### Debian / Ubuntu (.deb)
|
### Debian / Ubuntu (.deb)
|
||||||
|
|
||||||
Download the latest `.deb` from [GitHub Releases](https://github.com/janvete/resticview/releases) and install it:
|
Add the janvete APT repository and install:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt install ./resticview_*.deb
|
echo "deb [trusted=yes] https://git.janvete.com/seth/apt/raw/branch/main ./" | sudo tee /etc/apt/sources.list.d/janvete.list
|
||||||
# or
|
sudo apt update
|
||||||
sudo dpkg -i resticview_*.deb
|
sudo apt install resticview
|
||||||
```
|
```
|
||||||
|
|
||||||
### Prebuilt binaries
|
### Prebuilt binaries
|
||||||
|
|
||||||
Each [release](https://github.com/janvete/resticview/releases) also ships standalone binaries: `resticview-macos` (Apple Silicon) and `resticview-linux` (x86_64). Put the file on your `PATH` and make it executable:
|
Each [release](https://git.janvete.com/seth/resticview/releases) also ships standalone binaries: `resticview-macos` (Apple Silicon) and `resticview-linux` (x86_64). Put the file on your `PATH` and make it executable:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
chmod +x resticview-linux
|
chmod +x resticview-linux
|
||||||
|
|
@ -33,7 +33,7 @@ sudo mv resticview-linux /usr/local/bin/resticview
|
||||||
### From source
|
### From source
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install --git https://github.com/janvete/resticview
|
cargo install --git ssh://git@git-ssh.janvete.com:554/seth/resticview
|
||||||
```
|
```
|
||||||
|
|
||||||
`restic` must be installed and on `PATH`.
|
`restic` must be installed and on `PATH`.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue