diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 27c175f0..a9ee3dff 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -29,5 +29,3 @@ jobs: PASSWORD: "${{ secrets.REGISTRY_PASSWORD }}" - run: podman build --tag "$IMAGE_NAME" --file docs/Dockerfile --storage-opt "overlay.mount_program=/usr/bin/fuse-overlayfs" . - run: podman push "$IMAGE_NAME" - - run: scripts/export-docs-from-image - - run: curl --user "${{ secrets.REGISTRY_USERNAME }}:${{ secrets.REGISTRY_PASSWORD }}" --upload-file borgmatic-docs.tar.gz https://projects.torsion.org/api/packages/borgmatic-collective/generic/borgmatic-docs/$(head --lines=1 NEWS)/borgmatic-docs.tar.gz diff --git a/NEWS b/NEWS index 5661a0b6..61445d58 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ * Add documentation on repositories, including SSH, Rclone, S3, and B2: https://torsion.org/borgmatic/reference/configuration/repositories/ * Improve documentation search results for individual configuration options. + * Add borgmatic release artifacts (wheel and tarball) to each release on the releases page: + https://projects.torsion.org/borgmatic-collective/borgmatic/releases + * Move the tarball of borgmatic's HTML documentation from the packages page to the releases pages. 2.0.11 * #957: Document borgmatic's limitations around parallelism—both its own and Borg's. See the diff --git a/scripts/export-docs-from-image b/scripts/export-docs-from-image index 40d3e4e3..c6c51a01 100755 --- a/scripts/export-docs-from-image +++ b/scripts/export-docs-from-image @@ -2,10 +2,19 @@ set -e -docs_container_id=$(podman create "$IMAGE_NAME") -podman cp $docs_container_id:/usr/share/nginx/html - > borgmatic-docs-dump.tar +USER_PODMAN_SOCKET_PATH=/run/user/$UID/podman/podman.sock + +if [ -e "$USER_PODMAN_SOCKET_PATH" ]; then + export DOCKER_HOST="unix://$USER_PODMAN_SOCKET_PATH" + export CONTAINER_SOCKET_PATH="$USER_PODMAN_SOCKET_PATH" +fi + +podman build --tag borgmatic-release-docs --file docs/Dockerfile . +docs_container_id=$(podman create borgmatic-release-docs) +podman cp "$docs_container_id":/usr/share/nginx/html - > borgmatic-docs-dump.tar tar xf borgmatic-docs-dump.tar rm borgmatic-docs-dump.tar mv html borgmatic-docs -tar cfz borgmatic-docs.tar.gz borgmatic-docs -podman rm --volumes $docs_container_id +rm -f dist/borgmatic-docs.tar.gz +tar cfz dist/borgmatic-docs.tar.gz borgmatic-docs +podman rm --volumes "$docs_container_id" diff --git a/scripts/release b/scripts/release index cedafe15..7660ba3b 100755 --- a/scripts/release +++ b/scripts/release @@ -34,18 +34,40 @@ git push github $version # Build borgmatic and publish to pypi. rm -fr dist uv build -twine upload -r pypi --username __token__ dist/borgmatic-*.tar.gz -twine upload -r pypi --username __token__ dist/borgmatic-*-py3-none-any.whl +tarball_path=$(ls dist/borgmatic-*.tar.gz) +wheel_path=$(ls dist/borgmatic-*-py3-none-any.whl) +twine upload -r pypi --username __token__ "$tarball_path" +twine upload -r pypi --username __token__ "$wheel_path" + +# Build docs and extract HTML. +scripts/export-docs-from-image +docs_path=dist/borgmatic-docs.tar.gz # Set release changelogs on projects.torsion.org and GitHub. release_changelog="$(cat NEWS | sed '/^$/q' | grep -v '^\S')" escaped_release_changelog="$(echo "$release_changelog" | sed -z 's/\n/\\n/g' | sed -z 's/\"/\\"/g')" -curl --silent --request POST \ +release_id=$(curl --silent --request POST \ "https://projects.torsion.org/api/v1/repos/borgmatic-collective/borgmatic/releases" \ --header "Authorization: token $projects_token" \ --header "Accept: application/json" \ --header "Content-Type: application/json" \ --data "{\"body\": \"$escaped_release_changelog\", \"draft\": false, \"name\": \"borgmatic $version\", \"prerelease\": false, \"tag_name\": \"$version\"}" + | jq ".id") +curl --silent --request POST \ + "https://projects.torsion.org/api/v1/repos/borgmatic-collective/borgmatic/releases/$release_id/assets?name=$(basename $wheel_path)" \ + --header "Authorization: token $projects_token" \ + --header "Accept: application/json" \ + --form attachment=@"$wheel_path" +curl --silent --request POST \ + "https://projects.torsion.org/api/v1/repos/borgmatic-collective/borgmatic/releases/$release_id/assets?name=$(basename $tarball_path)" \ + --header "Authorization: token $projects_token" \ + --header "Accept: application/json" \ + --form attachment=@"$tarball_path" +curl --silent --request POST \ + "https://projects.torsion.org/api/v1/repos/borgmatic-collective/borgmatic/releases/$release_id/assets?name=$(basename $docs_path)" \ + --header "Authorization: token $projects_token" \ + --header "Accept: application/json" \ + --form attachment=@"$docs_path" github-release create --token="$github_token" --owner=witten --repo=borgmatic --tag="$version" --target_commit="main" \ --name="borgmatic $version" --body="$release_changelog"