diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e47ded8..be45ec9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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- tag while leaving stable- 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 diff --git a/tests/test_release_flatpak_oci.py b/tests/test_release_flatpak_oci.py index 2fef642..ccfcd77 100644 --- a/tests/test_release_flatpak_oci.py +++ b/tests/test_release_flatpak_oci.py @@ -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)