Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions tests/test_nightly_release_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_nightly_runs_full_package_and_publication_path(self) -> None:
self.assertIn("nightly: true", content)
self.assertIn("printf 'Automated nightly build from `%s`.\\n'", content)
self.assertIn("printf 'Generated from commit `%s`.\\n'", content)
self.assertNotIn("from `%s`.\\\\\\\\n", content)
self.assertNotIn("from `%s`.\\\\\\n", content)

def test_server_is_available_before_makefile_packaging(self) -> None:
content = TEMPLATE.read_text(encoding="utf-8")
Expand All @@ -52,7 +52,7 @@ def test_server_is_available_before_makefile_packaging(self) -> None:
def test_release_notes_do_not_emit_literal_newline_escapes(self) -> None:
content = TEMPLATE.read_text(encoding="utf-8")

self.assertNotIn(".\\\\\\\\n'", content)
self.assertNotIn(".\\\\\\n'", content)

def test_release_notes_use_shared_pull_request_action(self) -> None:
content = TEMPLATE.read_text(encoding="utf-8")
Expand All @@ -62,16 +62,41 @@ def test_release_notes_use_shared_pull_request_action(self) -> None:
f"actions/release-notes-from-pull-requests@{sha}",
content,
)
self.assertIn("from-ref: ${{ steps.release-note-range.outputs.from-ref }}", content)
self.assertIn("branch: ${{ steps.nightly.outputs.branch }}", content)
self.assertIn(
"from-ref: ${{ steps.release-note-range.outputs.from-ref }}",
content,
)
self.assertIn(
"branch: ${{ steps.nightly.outputs.branch }}",
content,
)
self.assertIn(
"CHANGES_FILE: ${{ steps.release-note-changes.outputs.changes-file }}",
content,
)
self.assertNotIn("declare -A seen_prs", content)
self.assertNotIn('commits/${sha}/pulls', content)
self.assertNotIn("unique_by(.number)", content)

def test_release_note_range_step_is_not_corrupted(self) -> None:
content = TEMPLATE.read_text(encoding="utf-8")

self.assertIn(
"grep -v '^nightly$' | head -1 || true)",
content,
)
self.assertEqual(
content.count("- name: Create or update GitHub release"),
1,
)
self.assertEqual(
content.count("- name: Attach tarball to GitHub release"),
1,
)
self.assertEqual(
content.count("- name: Upload nightly to Nextcloud App Store"),
1,
)

def test_checkout_credentials_are_not_persisted(self) -> None:
content = TEMPLATE.read_text(encoding="utf-8")

Expand Down
35 changes: 1 addition & 34 deletions workflow-templates/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,40 +242,7 @@ jobs:
working-directory: ${{ env.APP_NAME }}
shell: bash
run: |
last_tag="$(git tag --list --sort=-version:refname | grep -v '^nightly
- name: Create or update GitHub release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
NIGHTLY_BRANCH: ${{ steps.nightly.outputs.branch }}
run: |
title="Nightly ${APP_VERSION} (${NIGHTLY_BRANCH})"
notes="${APP_NAME}/release-notes.md"
if gh release view nightly --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then
gh release edit nightly --repo "${GITHUB_REPOSITORY}" --title "${title}" --notes-file "${notes}" --prerelease
else
gh release create nightly --repo "${GITHUB_REPOSITORY}" --title "${title}" --notes-file "${notes}" --prerelease
fi

- name: Attach tarball to GitHub release
id: attach-to-release
uses: svenstaro/upload-release-action@29e53e917877a24fad85510ded594ab3c9ca12de # v2.11.5
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}.tar.gz
asset_name: ${{ env.APP_NAME }}-nightly.tar.gz
tag: nightly
overwrite: true

- name: Upload nightly to Nextcloud App Store
uses: nextcloud-libraries/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1.0.3
with:
app_name: ${{ env.APP_NAME }}
appstore_token: ${{ secrets.APPSTORE_TOKEN }}
download_url: ${{ steps.attach-to-release.outputs.browser_download_url }}
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
nightly: true
| head -1 || true)"
last_tag="$(git tag --list --sort=-version:refname | grep -v '^nightly$' | head -1 || true)"
echo "from-ref=${last_tag}" >> "${GITHUB_OUTPUT}"

- name: Build nightly change list
Expand Down
Loading