diff --git a/.github/workflows/release-devel.yaml b/.github/workflows/release-devel.yaml index 8dd19b9..034ee20 100644 --- a/.github/workflows/release-devel.yaml +++ b/.github/workflows/release-devel.yaml @@ -1,6 +1,7 @@ --- name: release-devel -on: [push] +on: + - push env: GO_VERSION: 1.21.0 @@ -11,17 +12,25 @@ permissions: jobs: - test-version-darwin-arm64: - needs: tests - name: release-darwin-arm64 + release-snapshot-workflow: + name: release-workflow runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: wangyoucao577/go-release-action - with: - github_token: ${{ secrets.PUSHTOKEN }} - goos: darwin - goarch: arm64 - project_path: ./milbi - overwrite: true - release_tag: devel + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ env.GO_VERSION }} + cache: false + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean --snapshot + workdir: milbi + env: + GITHUB_TOKEN: ${{ secrets.PUSHTOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 7b4a2df..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: release -on: - push: - branches: - - main - tags: - - '*' - -env: - GO_VERSION: 1.21.0 - -permissions: - contents: write - packages: write - -jobs: - release-darwin-arm64: - needs: tests - name: release-darwin-arm64 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: wangyoucao577/go-release-action - with: - github_token: ${{ secrets.PUSHTOKEN }} - goos: darwin - goarch: arm64 - project_path: ./milbi - overwrite: true \ No newline at end of file diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fe8c7f0..c2c0a3c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -11,10 +11,11 @@ jobs: name: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + cache: false - name: build run: | sudo snap install task --classic @@ -28,10 +29,11 @@ jobs: needs: - go-build steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + cache: false - name: install restic run: | sudo apt-get install -y wget bzip2 rsync diff --git a/.gitignore b/.gitignore index d7f10ae..55e5ada 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ milbi/tests/files/resticrepo-copy/* !milbi/tests/files/resticrepo-copy/.gitkeep milbi/tests/files/resticrepo-copy-2/* !milbi/tests/files/resticrepo-copy-2/.gitkeep +dist/ \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..50b25ca --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,37 @@ +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 1 + +before: + hooks: + - go mod tidy + - go generate ./... + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + dir: milbi + +archives: + - format: tar.gz + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index 21b0814..0000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Read the Docs configuration file -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -# Build documentation in the docs/ directory with Sphinx -sphinx: - configuration: docs/conf.py - -# Build documentation with MkDocs -#mkdocs: -# configuration: mkdocs.yml - -# Optionally build your docs in additional formats such as PDF -formats: - - pdf - -python: - version: 3.8 - install: - - requirements: docs/requirements.txt - - {path: ., method: pip} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c4b770a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# changelog + +## 0.1 + +- first version that might run on other notebooks than mine. + +## 1.0 + +- releases via PyPi + +## 2.0 + +The release replaces Python with Golang. + +### Major changes + +Switched to a new config format from a single custom yaml file to a config that borrows its format from Kubernetes manifests. diff --git a/CHANGELOG.rst b/CHANGELOG.rst deleted file mode 100644 index d2032e3..0000000 --- a/CHANGELOG.rst +++ /dev/null @@ -1,8 +0,0 @@ -========= -Changelog -========= - -Version 0.1 -=========== - -- first version that might run on other notebooks than mine. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index 95fac60..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,5 +0,0 @@ -============ -Contributors -============ - -* la3mmchen \ No newline at end of file diff --git a/AUTHORS.rst b/CONTRIBUTORS.md similarity index 100% rename from AUTHORS.rst rename to CONTRIBUTORS.md diff --git a/LICENSE.txt b/LICENSE.txt index ad6555c..29fd443 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2023 la3mmchen +Copyright (c) 2024 la3mmchen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.rst b/README.rst deleted file mode 100644 index 5388a6e..0000000 --- a/README.rst +++ /dev/null @@ -1,8 +0,0 @@ -====== -milbi -====== - - helps to organize backups. with a config. yaml! - - -See project information at `Github la3mmchen/milbi ` diff --git a/TODO.md b/TODO.md deleted file mode 100644 index e69de29..0000000 diff --git a/readme.md b/readme.md index 049b1cb..4babc55 100644 --- a/readme.md +++ b/readme.md @@ -44,123 +44,7 @@ processed 2 files, 1 B in 0:00 snapshot 5e9a299a saved ``` -Milbi works with [restic](https://restic.net/) at the moment. but it should work with [borg](https://borgbackup.readthedocs.io/) as well - at least in theory. - -## features - -### backup - -at the moment, mibli can be configured to do backups with the following technologies: - -- backups with [restic](https://restic.readthedocs.io/) -- backups with [borg](https://borgbackup.readthedocs.io/) - -### synchronization - -additionally, milbi can: - -- copy stuff with rsync -- sync to backblaze b2 with [b2 cli](https://www.backblaze.com/b2/docs/quick_command_line.html) - -### verification - -```bash -$ ./milbi.py check -doing my-repo -using temporary cache in /var/folders/vz/ct7cy2591p58dkbxflsgh18dgxl8xl/T/restic-check-cache-4190130004 -create exclusive lock for repository -load indexes -check all packs -check snapshots, trees and blobs -[0:10] 100.00% 1 / 1 snapshots - -no errors were found -``` - -in addition to running checks on the repositories, milbi can randomly fuzz through the files that should be backuped and search them in the backup repository. - -```bash -/milbi.py --config ./tests/files/clitest-config.yaml fuzz --count 1 --verify - -fuzzing around in configured backups.. -preseeding files for ./tests/files/randomfiles. this might take a while.. -...by checking for file file2.txt [repo [./tests/files/resticrepo] / target [./tests/files/randomfiles]] -restoring to ~/milbi/./tests/files/resticrepo-restore/restic -verifying files in ~/milbi/./tests/files/resticrepo-restore/restic -finished verifying 1 files in ~/milbi/./tests/files/resticrepo-restore/restic (took 4ms) - -``` - -## configuration - -milbi understands yaml. run `milbi config --explain` to get a config explanation. - -```yaml ---- -borgbackup: - bin: Path to borg binary to use. - enabled: 'A trigger to activate the backup with borgbackup. (Options: True / False).' - repos: - - excludes: A pattern for files to be excluded from the repository; e.g. *github* - keep: 'For prune actions: How many days to keep in the repository; e.g. 2 for 2 days' - passphrase: Passphrase for the repository - repo: Path to the existing borg repository. -(...) -``` - -see [config example](https://github.com/la3mmchen/milbi/blob/main/example-config.yaml) for a full example. - -## flows - -milbi supports the invocation of multiple subcommands via the flows config. - -an example can look like this. with this milbi first creates a backup, prunes, then checks the config, and afterwards executes the configured syncs. - -```yaml -(...) -flows: - - name: default - tasks: - - backup - - prune - - check - - sync -``` - -start the flow via `flows` subcommand: - -``` -milbi --config tests/files/clitest-config.yaml flows --flow=default -(...) -flow [default]: backup > check > prune > sync -``` - -## run it - -you can find a pypi package at https://pypi.org/project/milbi/ - -```bash -$ pip3 install milbi -$ milbi --help -``` - -### prepare repos - -milbi does not handle repository creation of any kind. just make sure to create the repo for the tool you want to use before. - -#### restic - -initialize a restic repo and create a secret key if you want to have one. - -```bash - -restic init --repo - -``` - -#### borbackup - -to be described +Milbi works with [restic](https://restic.net/) at the moment. ## development stuff