mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-15 15:02:24 +00:00
feat(release): dual-push Flatpak OCI layouts to Docker Hub (#178)
* feat(release): dual-push Flatpak OCI layouts to Docker Hub * fix(release): derive Docker Hub repo name from REGISTRY
This commit is contained in:
1 parent
4b23a68072
commit
3b3ea7ed62
3 files changed
+46
-3
No files matched your search
@@ -118,6 +118,12 @@ on:
|
||||
# every Linux package format, the Flatpak bundle's commit and OCI image, and SHA256SUMS.txt.
|
||||
LINUX_SIGNING_KEY:
|
||||
required: false
|
||||
DOCKERHUB_USERNAME:
|
||||
description: "Username for publishing Flatpak OCI layouts to Docker Hub"
|
||||
required: false
|
||||
DOCKERHUB_TOKEN:
|
||||
description: "Personal access token for publishing Flatpak OCI layouts to Docker Hub"
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
version:
|
||||
@@ -574,13 +580,15 @@ jobs:
|
||||
tarball="${tarballs[0]}"
|
||||
packaging/linux/flatpak-bundle.sh "$tarball"
|
||||
printf 'tarball=%s\n' "$tarball" >> "$GITHUB_OUTPUT"
|
||||
- name: Publish Flatpak OCI layout to GHCR
|
||||
- name: Publish Flatpak OCI layout to GHCR and Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
RELEASE_VERSION: ${{ needs.version.outputs.version }}
|
||||
ARCH: ${{ matrix.arch }}
|
||||
REGISTRY: ghcr.io/${{ github.repository }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
TARBALL: ${{ steps.flatpak_bundle.outputs.tarball }}
|
||||
run: |
|
||||
if [ -x packaging/linux/flatpak-oci.sh ]; then
|
||||
@@ -609,6 +617,19 @@ jobs:
|
||||
# signature lookaside, and the release keeps it so the digest can be checked.
|
||||
skopeo inspect --raw --creds "$creds" \
|
||||
"docker://$REGISTRY:$RELEASE_VERSION-$ARCH" >"dist/release/$base.oci-manifest.json"
|
||||
|
||||
if [ -n "${DOCKERHUB_USERNAME:-}" ] && [ -n "${DOCKERHUB_TOKEN:-}" ]; then
|
||||
dh_registry="docker.io/storytold/${REGISTRY##*/}"
|
||||
dh_creds="$DOCKERHUB_USERNAME:$DOCKERHUB_TOKEN"
|
||||
echo "==> Pushing to $dh_registry:$RELEASE_VERSION-$ARCH"
|
||||
skopeo copy --format oci --dest-creds "$dh_creds" "oci:$layout" "docker://$dh_registry:$RELEASE_VERSION-$ARCH"
|
||||
if [[ "$RELEASE_VERSION" != *-* && "$GITHUB_REF" == refs/heads/release ]]; then
|
||||
echo "==> Pushing to $dh_registry:stable-$ARCH"
|
||||
skopeo copy --format oci --dest-creds "$dh_creds" "oci:$layout" "docker://$dh_registry:stable-$ARCH"
|
||||
else
|
||||
echo "Leaving $dh_registry:stable-$ARCH unchanged: $RELEASE_VERSION from $GITHUB_REF is not a stable release-branch build"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
|
||||
Reference in new issue
Block a user