ci: Push docker hub description automatically on main branch
This commit is contained in:
+17
-12
@@ -283,18 +283,23 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "Skipping push to 'latest' tag for pre-release..."
|
echo "Skipping push to 'latest' tag for pre-release..."
|
||||||
fi
|
fi
|
||||||
# TODO: Enable dockerhub description update again, once a solution for the permission problem is found:
|
|
||||||
# https://github.com/docker/hub-feedback/issues/1927
|
|
||||||
# - name: Update descriptions on Docker Hub
|
docker-description:
|
||||||
# env:
|
name: Release / Docker Hub Description
|
||||||
# DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
|
runs-on: ubuntu-22.04
|
||||||
# run: |
|
if: |
|
||||||
# if [[ -z "$ISPRERELEASE" ]]; then
|
vars.DOCKER_REPO && vars.DOCKER_USER &&
|
||||||
# echo "Updating description on Docker Hub..."
|
github.ref == 'refs/tags/devel'
|
||||||
# postgrest-release-dockerhub-description
|
steps:
|
||||||
# else
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||||
# echo "Skipping updating description for pre-release..."
|
- uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0
|
||||||
# fi
|
with:
|
||||||
|
username: ${{ vars.DOCKER_USER }}
|
||||||
|
password: ${{ secrets.DOCKER_PASS }}
|
||||||
|
repository: ${{ vars.DOCKER_REPO }}/postgrest
|
||||||
|
short-description: ${{ github.event.repository.description }}
|
||||||
|
readme-filepath: ./nix/tools/release/docker-hub-full-description.md
|
||||||
|
|
||||||
|
|
||||||
docker-arm:
|
docker-arm:
|
||||||
|
|||||||
@@ -1,52 +1,7 @@
|
|||||||
{ buildToolbox
|
{ buildToolbox
|
||||||
, checkedShellScript
|
, checkedShellScript
|
||||||
, curl
|
|
||||||
, jq
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
dockerHubDescription =
|
|
||||||
let
|
|
||||||
description =
|
|
||||||
./docker-hub-description.md;
|
|
||||||
|
|
||||||
fullDescription =
|
|
||||||
./docker-hub-full-description.md;
|
|
||||||
in
|
|
||||||
checkedShellScript
|
|
||||||
{
|
|
||||||
name = "postgrest-release-dockerhub-description";
|
|
||||||
docs = "Update the repository description on Docker Hub.";
|
|
||||||
args = [
|
|
||||||
"ARG_USE_ENV([DOCKER_USER], [], [DockerHub user name])"
|
|
||||||
"ARG_USE_ENV([DOCKER_PASS], [], [DockerHub password])"
|
|
||||||
"ARG_USE_ENV([DOCKER_REPO], [], [DockerHub repository])"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
''
|
|
||||||
# ARG_USE_ENV only adds defaults or docs for environment variables
|
|
||||||
# We manually implement a required check here
|
|
||||||
# See also: https://github.com/matejak/argbash/issues/80
|
|
||||||
: "''${DOCKER_USER:?DOCKER_USER is required}"
|
|
||||||
: "''${DOCKER_PASS:?DOCKER_PASS is required}"
|
|
||||||
: "''${DOCKER_REPO:?DOCKER_REPO is required}"
|
|
||||||
|
|
||||||
echo "Logging in to Docker Hub to get an auth token..."
|
|
||||||
token="$(
|
|
||||||
${curl}/bin/curl --fail -s \
|
|
||||||
--data-urlencode "username=$DOCKER_USER" \
|
|
||||||
--data-urlencode "password=$DOCKER_PASS" \
|
|
||||||
"https://hub.docker.com/v2/users/login/" \
|
|
||||||
| ${jq}/bin/jq -r .token
|
|
||||||
)"
|
|
||||||
|
|
||||||
repo_url="https://hub.docker.com/v2/repositories/$DOCKER_REPO/postgrest/"
|
|
||||||
echo "Patching both descriptions at $repo_url ..."
|
|
||||||
${curl}/bin/curl --fail -X PATCH "$repo_url" \
|
|
||||||
-H "Authorization: JWT $token" \
|
|
||||||
--data-urlencode description@${description} \
|
|
||||||
--data-urlencode full_description@${fullDescription}
|
|
||||||
'';
|
|
||||||
|
|
||||||
release =
|
release =
|
||||||
checkedShellScript
|
checkedShellScript
|
||||||
{
|
{
|
||||||
@@ -133,5 +88,5 @@ in
|
|||||||
buildToolbox
|
buildToolbox
|
||||||
{
|
{
|
||||||
name = "postgrest-release";
|
name = "postgrest-release";
|
||||||
tools = { inherit dockerHubDescription release; };
|
tools = { inherit release; };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
REST API for any Postgres database
|
|
||||||
@@ -68,3 +68,5 @@ The image is built from scratch using
|
|||||||
no commands are listed in the image history. See the [PostgREST
|
no commands are listed in the image history. See the [PostgREST
|
||||||
respository](https://github.com/PostgREST/postgrest/tree/main/nix/tools/docker) for
|
respository](https://github.com/PostgREST/postgrest/tree/main/nix/tools/docker) for
|
||||||
details on the build process and how to inspect the image.
|
details on the build process and how to inspect the image.
|
||||||
|
|
||||||
|
This does not apply to the arm64 variant, which is based on Ubuntu.
|
||||||
|
|||||||
Reference in New Issue
Block a user