mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-23 19:12:02 +01:00
feat(release): push nightly-<arch> Flatpak OCI tag for nightly builds (#340)
This commit is contained in:
1 parent
077d4657f7
commit
01891bc4df
2 files changed
+22
No files matched your search
@@ -691,9 +691,14 @@ jobs:
|
||||
echo "==> Pushing to $REGISTRY:$RELEASE_VERSION-$ARCH"
|
||||
skopeo copy --format oci --dest-creds "$creds" "oci:$layout" "docker://$REGISTRY:$RELEASE_VERSION-$ARCH"
|
||||
# Only a stable version built from the release branch may move the stable tag.
|
||||
# Nightly prereleases move the nightly-<arch> tag while leaving stable-<arch> alone.
|
||||
if [[ "$RELEASE_VERSION" != *-* && "$GITHUB_REF" == refs/heads/release ]]; then
|
||||
echo "==> Pushing to $REGISTRY:stable-$ARCH"
|
||||
skopeo copy --format oci --dest-creds "$creds" "oci:$layout" "docker://$REGISTRY:stable-$ARCH"
|
||||
elif [[ "$RELEASE_VERSION" == *-nightly* ]]; then
|
||||
echo "Leaving $REGISTRY:stable-$ARCH unchanged: $RELEASE_VERSION from $GITHUB_REF is not a stable release-branch build"
|
||||
echo "==> Pushing to $REGISTRY:nightly-$ARCH"
|
||||
skopeo copy --format oci --dest-creds "$creds" "oci:$layout" "docker://$REGISTRY:nightly-$ARCH"
|
||||
else
|
||||
echo "Leaving $REGISTRY:stable-$ARCH unchanged: $RELEASE_VERSION from $GITHUB_REF is not a stable release-branch build"
|
||||
fi
|
||||
@@ -710,6 +715,10 @@ jobs:
|
||||
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"
|
||||
elif [[ "$RELEASE_VERSION" == *-nightly* ]]; then
|
||||
echo "Leaving $dh_registry:stable-$ARCH unchanged: $RELEASE_VERSION from $GITHUB_REF is not a stable release-branch build"
|
||||
echo "==> Pushing to $dh_registry:nightly-$ARCH"
|
||||
skopeo copy --format oci --dest-creds "$dh_creds" "oci:$layout" "docker://$dh_registry:nightly-$ARCH"
|
||||
else
|
||||
echo "Leaving $dh_registry:stable-$ARCH unchanged: $RELEASE_VERSION from $GITHUB_REF is not a stable release-branch build"
|
||||
fi
|
||||
|
||||
@@ -119,6 +119,19 @@ class FlatpakOciPublishTests(unittest.TestCase):
|
||||
self.assertNotIn("docker://ghcr.io/storytold/democraft:stable-x86_64", log)
|
||||
self.assertIn("docker://docker.io/storytold/democraft:1.2.0-rc.1-x86_64", log)
|
||||
self.assertNotIn("docker://docker.io/storytold/democraft:stable-x86_64", log)
|
||||
|
||||
def test_a_nightly_build_pushes_nightly_tag_and_leaves_stable_alone(self):
|
||||
result = self.publish("1.2.0-nightly.20261123", "refs/heads/main",
|
||||
DOCKERHUB_USERNAME="user", DOCKERHUB_TOKEN="secret")
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
log = self.log.read_text()
|
||||
self.assertIn("docker://ghcr.io/storytold/democraft:1.2.0-nightly.20261123-x86_64", log)
|
||||
self.assertIn("docker://ghcr.io/storytold/democraft:nightly-x86_64", log)
|
||||
self.assertNotIn("docker://ghcr.io/storytold/democraft:stable-x86_64", log)
|
||||
self.assertIn("docker://docker.io/storytold/democraft:1.2.0-nightly.20261123-x86_64", log)
|
||||
self.assertIn("docker://docker.io/storytold/democraft:nightly-x86_64", log)
|
||||
self.assertNotIn("docker://docker.io/storytold/democraft:stable-x86_64", log)
|
||||
self.assertNotIn("docker://docker.io/storytold/democraft:stable-x86_64", log)
|
||||
self.assertIn("Leaving docker.io/storytold/democraft:stable-x86_64 unchanged", result.stdout)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user