{"id":19207974,"url":"https://github.com/ubuntu/desktop-snaps","last_synced_at":"2025-08-11T09:17:43.963Z","repository":{"id":66878593,"uuid":"573108950","full_name":"ubuntu/desktop-snaps","owner":"ubuntu","description":"Snap automation tools","archived":false,"fork":false,"pushed_at":"2024-10-24T07:23:38.000Z","size":741,"stargazers_count":15,"open_issues_count":111,"forks_count":9,"subscribers_count":4,"default_branch":"stable","last_synced_at":"2024-10-25T04:20:50.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ubuntu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-01T18:06:28.000Z","updated_at":"2024-10-24T07:23:42.000Z","dependencies_parsed_at":"2023-11-20T23:22:40.155Z","dependency_job_id":"cf1c16e4-2d56-4a4d-a723-6c3e7ff6c61f","html_url":"https://github.com/ubuntu/desktop-snaps","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubuntu%2Fdesktop-snaps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubuntu%2Fdesktop-snaps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubuntu%2Fdesktop-snaps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubuntu%2Fdesktop-snaps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ubuntu","download_url":"https://codeload.github.com/ubuntu/desktop-snaps/tar.gz/refs/heads/stable","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223831092,"owners_count":17210395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T13:23:31.016Z","updated_at":"2025-04-20T15:33:33.985Z","avatar_url":"https://github.com/ubuntu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Toolbox\n\nThis repository is a collection of automation tools needed for the snaps on Ubuntu desktop.\n\nThe tools should be able to automatically:\n- notice when there is a new tag upstream vs what we have in the snap store --candidate\n- open issue about new version\n- open PR with new candidate version change (the PR will generate a build)\n- launch newly built snap (possibly using xvfb) and grab a screenshot and attach it to the PR\n\nThen when a project has a new upstream patch, all we need to review is the automatically opened PR and screenshot.\nOnce the PR has been manually merged, the launchpad mirror will pick up the change and automatically build a snap for --candidate.\nThen the snap in --candidate needs to be manually tested before promoting it to --stable.\n\n\n## Tools in the Toolbox\n\n### candidate-snaps-review\n\nThis tool is really a set of 3 useful tools:\n* _snapchanges.py_ is a utility to display changes in a snap between stable and candidate channels\n* _snaps.py_ defines the list of snaps the Ubuntu Desktop team is interested in\n* _candidate.yml_ is a cache of candidate revisions already processed\n* _close-fixed-issues.py_ closes issues that were opened against a candidate no longer available\n\n### updatesnap.py\nThis tool eases the inspection of the gnome-sdk snap that builds many parts. Since each part points to an upstream repo, updatesnap.py will check for newer upstream releases than the gnome-sdk part contains. It outputs an array of the update data.\n\nThis data should be included in any automatically created PR.\n\n### updatesnapyaml.py\nThis tool utilizes updatesnap.py to generate a new snapcraft.yaml with the tag updated, provided a new tag is available upstream.\n\nFor example, to run it locally on another repo (gnome-calculator in this case) to generate the update, pass it the url of the repo with the snapcraft.yaml in quesiton to be updated:\n\n```\n./updatesnap/updatesnapyaml.py --github-user GITHUB_USER --github-token GITHUB_TOKEN https://github.com/ubuntu/gnome-calculator.git\n```\n\nThis tool can also be used to automate version updates of snap based on a specified version schema.\nWhen the `--version-schema` (optional) flag is provided as input, the tool will automatically increment the version according to the specified schema.\n\nTo include this feature as a github worflow you need to pass an optional input in `with` command.\n\n```\n./updatesnap/updatesnapyaml.py --github-user GITHUB_USER --github-token GITHUB_TOKEN --version-schema VERSION_SCHEMA https://github.com/ubuntu/gnome-calculator.git\n```\n\nThis tool can also be used to list the parts defined in the YAML file directly within the README for easier tracking.\n\nEnsure your README file contains the following comment block where you want the parts to be listed:\n```\n\u003c!-- Begin Included Components --\u003e\n\n\u003c!-- End Included Components --\u003e\n```\n\nTo use this functionality locally, run the following command:\n```\n./updatesnap/updatesnapyaml.py --github-user GITHUB_USER --github-token GITHUB_TOKEN --readme-path README_PATH https://github.com/ubuntu/gnome-calculator.git\n```\n\n### How Snap Version Automation Works\n\nThe snap version automation feature functions by extracting version information from the designated section labeled as `adopt-info`. Subsequently, it automatically updates the version of the primary snap. This versioning scheme consists of two components:\n\n- **Primary Upstream Component Version**: This component comprises the version number of the primary upstream component, which is extracted from the `adopt-info` section.\n\n- **Package Release Number**: The package release number is represented by a small integer and indicates the number of releases of the snap, provided the primary upstream component remains unchanged. In case of a new release of the primary component, the version number is incremented accordingly, with the package release number being reset to 1. Additionally, any other modifications to the package result in an increment of the package release number by 1.\n\n**Example:**\nFor `cups-snap`, the version is defined as `2.4.7-6`, where `2.4.7` represents the primary upstream component source tag derived from part of the `adopt info` section, and `6` signifies the package release.\n\n**Prerequisites to Apply Snap Version Automation:**\nBefore applying snap version automation, ensure the following prerequisites are met:\n\n- The `version` must be explicitly defined in the snapcraft.yaml metadata, preferably in the headers section of the respective project.\n- The `adopt-info` section must be included in snapcraft.yaml metadata to ensure that the primary upstream component can be derived from it.\n- Correct definition of the `version-schema` in the GitHub workflow is essential for smooth operation.\n\n***Examples of Version-Schema:***\n\n| Source Tag of Primary Upstream Component | Version-Schema | Snap Version |\n|----------|----------|----------|\n| v2.4.7 | 'v(\\d+\\.\\d+\\.\\d+)' | 2.4.7-2 |\n| debian/3.22.10+dfsg0-4 | '^debian/(\\d+\\.\\d+\\.\\d+)' | 3.22.10-5 |\n| 20240108 | '^(\\d{8})' | 20240108-1 |\n| ghostpdl-10.02.1 | '^ghostpdl-(\\d+\\.\\d+\\.\\d+)' | 10.02.1-6 |\n\n### GitHub action\nThis action should be utilized by other repos' workflows. The action checks out this repository to use updatesnapyaml.py and replaces the old snapcraft.yaml with the new one.\n\nFor example, to use this directly in another repo's workflow:\n\n```\nname: Open a PR if a new update is available\n\non:\n  schedule:\n    # Daily for now\n    - cron: '9 7 * * *'\n  workflow_dispatch:\n\njobs:\n  update-snapcraft-yaml:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout this repo\n        uses: actions/checkout@v4\n      - name: Run desktop-snaps action\n        uses: ubuntu/desktop-snaps@add-action\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          repo: ${{ github.repository }}\n```\n\nFor example, to use snap version automation\n```\nname: Push new tag update to stable branch\n\non:\n  schedule:\n    # Daily for now\n    - cron: '9 7 * * *'\n  workflow_dispatch:\n\njobs:\n  update-snapcraft-yaml:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout this repo\n        uses: actions/checkout@v4\n      - name: Run desktop-snaps action  \n        uses: ubuntu/desktop-snaps@stable\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          repo: ${{ github.repository }}\n          version-schema: '^debian/(\\d+\\.\\d+\\.\\d+)'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubuntu%2Fdesktop-snaps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fubuntu%2Fdesktop-snaps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubuntu%2Fdesktop-snaps/lists"}