diff --git a/.github/workflows/build-debian-package.yml b/.github/workflows/build-debian-package.yml index 6d32204..17ec9a6 100644 --- a/.github/workflows/build-debian-package.yml +++ b/.github/workflows/build-debian-package.yml @@ -12,22 +12,20 @@ on: required: true default: debian/qcom-next - distro-codename: - description: The distribution codename to build for. Ex noble, questing, etc + suite: + description: The distribution codename or Debian suite to build for. Ex noble, questing, resolute, trixie, sid, unstable type: choice - default: noble + default: unstable options: - noble - questing - resolute + - unstable + - forky - trixie + - bookworm - sid - abi-checker: - description: Run the ABI checker or not - type: boolean - default: false - permissions: contents: read packages: read @@ -38,5 +36,5 @@ jobs: with: qcom-build-utils-ref: main debian-ref: ${{ inputs.debian-ref }} - distro-codename: ${{ inputs.distro-codename }} - run-abi-checker: ${{ inputs.abi-checker }} \ No newline at end of file + suite: ${{ inputs.suite }} + debusine-parent-workspace: ${{ vars.DEBUSINE_PARENT_WORKSPACE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df6634f..61b0b04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,15 +7,18 @@ on: workflow_dispatch: inputs: - distro-codename: - description: The distribution codename to build for. Ex noble, questing, etc + suite: + description: The distribution codename or Debian suite to release for. Ex noble, questing, resolute, trixie, bookworm, sid, unstable type: choice default: noble options: - noble - questing - resolute + - unstable + - forky - trixie + - bookworm - sid debian-branch: @@ -26,8 +29,8 @@ on: test-run: description: | - If true, the built packages will be uploaded to the 'test' folder in S3. - If false, the built packages will be uploaded to the 'proposed' folder in S3 + Debian suites: if true, stop after the Debusine build and installability test. + Ubuntu codenames: preserve the previous release flow, including upload to the test S3 location. type: boolean default: true @@ -41,8 +44,12 @@ jobs: uses: qualcomm-linux/qcom-build-utils/.github/workflows/qcom-release-reusable-workflow.yml@main with: qcom-build-utils-ref: main - distro-codename: ${{ github.event.inputs.distro-codename }} + suite: ${{ github.event.inputs.suite }} debian-branch: ${{ github.event.inputs.debian-branch }} test-run: ${{ github.event.inputs.test-run == 'true' && true || false }} + debusine-parent-workspace: ${{ vars.DEBUSINE_PARENT_WORKSPACE }} secrets: - PAT: ${{secrets.DEB_PKG_BOT_CI_TOKEN}} \ No newline at end of file + PAT: ${{ secrets.DEB_PKG_BOT_CI_TOKEN }} + DEBUSINE_USER: ${{ secrets.DEBUSINE_USER }} + DEBUSINE_TOKEN: ${{ secrets.DEBUSINE_TOKEN }} + DEBUSINE_RELEASE_TOKEN: ${{ secrets.DEBUSINE_RELEASE_TOKEN }} diff --git a/.github/workflows/workflows_sync.yml b/.github/workflows/workflows_sync.yml deleted file mode 100644 index e439cba..0000000 --- a/.github/workflows/workflows_sync.yml +++ /dev/null @@ -1,248 +0,0 @@ -name: Workflows Sync -description: | - Sync workflows from pkg-template back to all repositories that used pkg-template as a template. - This workflow executes periodically in the templated repositories in order to keep them up to date - with the latest workflows defined in pkg-template. - -on: - workflow_dispatch: - inputs: - confirmation: - type: boolean - default: false - required: true - description: | - Tick to confirm creating pull requests to sync workflows from pkg-template to all repositories that used pkg-template as a template. - If not ticked, the workflow will not create any pull requests and will simply print the list of repositories that would have been synced. - -permissions: - contents: write - pull-requests: write - -jobs: - sync: - runs-on: ubuntu-latest - if: github.event.repository.name == 'pkg-template' - - steps: - - - name: Checkout repository - uses: actions/checkout@v4 - with: - path: pkg-template - - - name: Sync workflows from pkg-template - id: sync - env: - GH_TOKEN: ${{secrets.DEB_PKG_BOT_CI_TOKEN}} - ORG: qualcomm-linux - BOT_NAME: ${{vars.DEB_PKG_BOT_CI_NAME}} - BOT_EMAIL: ${{vars.DEB_PKG_BOT_CI_EMAIL}} - BOT_USERNAME: ${{vars.DEB_PKG_BOT_CI_USERNAME}} - run: | - # Define explicit list of repositories to exclude - EXCLUDE_REPOS=("pkg-template" \ - "pkg-example" \ - "pkg-oss-staging-repo" \ - "pkg-linux-firmware" \ - "pkg-camera-service-temp" \ - "pkg-gst-plugins-imsdk-temp" \ - "pkg-kernel-fedora" \ - "pkg-linux-kernel" ) - - # Array to store created PR URLs - PR_URLS=() - - # Get the list of all repositories that used pkg-template as a template - repos=$(gh repo list --limit 9999 $ORG --json name --jq '.[] | select(.name | startswith("pkg-")) | .name') - - echo "List of repositories starting with 'pkg-': $repos" - - # Fetch pr-pre-post-merge.yml from pkg-template's debian/latest branch - DEBIAN_LATEST_WORKFLOW_FILE="$(pwd)/debian-latest-pr-pre-post-merge.yml" - echo "๐Ÿ“ฅ Fetching pr-pre-post-merge.yml from pkg-template debian/latest branch" - gh api "repos/$ORG/pkg-template/contents/.github/workflows/pr-pre-post-merge.yml?ref=debian/latest" \ - --jq '.content' | base64 -d > "$DEBIAN_LATEST_WORKFLOW_FILE" - - for repo in $repos; do - # Skip excluded repositories - if [[ " ${EXCLUDE_REPOS[@]} " =~ " ${repo} " ]]; then - echo "โญ๏ธ Skipping excluded repository: $repo" - continue - fi - - echo "๐Ÿ”„ Checking repo: $repo" - - # Check if the bot account has write or admin permissions - echo " ๐Ÿ” Checking permissions for $BOT_USERNAME on $repo" - permission_response=$(gh api repos/$ORG/$repo/collaborators/$BOT_USERNAME/permission 2>/dev/null || echo "") - - if [[ -z "$permission_response" ]]; then - echo " โ›” Cannot verify permissions for $BOT_USERNAME on $repo - skipping" - continue - fi - - permission_level=$(echo "$permission_response" | jq -r '.permission') - - if [[ "$permission_level" != "admin" && "$permission_level" != "write" ]]; then - echo " โ›” $BOT_USERNAME does not have write/admin permissions on $repo (has: $permission_level) - skipping" - continue - fi - - echo " โœ… $BOT_USERNAME has $permission_level permissions on $repo" - - # Clone the target repository - gh repo clone "$ORG/$repo" "$repo" 2>&1 | sed 's/^/ /' - cd "$repo" - - # Detect the default branch (usually 'main' but some repos use 'master') - default_branch=$(gh api repos/$ORG/$repo --jq '.default_branch') - echo " ๐ŸŒฟ Default branch for $repo: $default_branch" - - # Configure git to use gh CLI for authentication - gh auth setup-git - git config user.name "$BOT_NAME" - git config user.email "$BOT_EMAIL" - - # Delete the sync branch if it exists from a previous run - if git ls-remote --exit-code --heads origin sync/pkg-template-workflows > /dev/null 2>&1; then - echo " ๐Ÿงน Deleting existing sync/pkg-template-workflows branch from remote" - git push origin --delete sync/pkg-template-workflows 2>&1 | sed 's/^/ /' - fi - - # Track if changes are needed - isDirty=false - - # Special case: Remove workflows_sync.yml if it exists in target repo - if [[ -f ".github/workflows/workflows_sync.yml" ]]; then - echo " ๐Ÿ—‘๏ธ Removing workflows_sync.yml (should not exist in templated repos)" - rm ".github/workflows/workflows_sync.yml" - isDirty=true - fi - - # Compare and sync workflow files - for workflow in ../pkg-template/.github/workflows/*.yml; do - workflow_name=$(basename "$workflow") - - # Skip workflows_sync.yml and pr-pre-post-merge.yml (handled separately per debian/* branch) - if [[ "$workflow_name" == "workflows_sync.yml" || "$workflow_name" == "pr-pre-post-merge.yml" ]]; then - continue - fi - - target_workflow=".github/workflows/$workflow_name" - - if [[ -f "$target_workflow" ]]; then - if diff -q "$workflow" "$target_workflow" > /dev/null; then - echo " โœ… $workflow_name is up to date" - else - echo " โŒ $workflow_name differs from template" - cp "$workflow" "$target_workflow" - isDirty=true - fi - else - echo " + Creating $workflow_name (missing from $repo)" - mkdir -p ".github/workflows" - cp "$workflow" "$target_workflow" - isDirty=true - fi - done - - # Create branch, commit, and push main branch changes if needed - if [[ "$isDirty" == "true" ]]; then - echo " ๐Ÿ“ Creating branch and committing main branch changes" - git checkout -b sync/pkg-template-workflows 2>&1 | sed 's/^/ /' - git add .github/workflows/ - git commit -s -m "chore: sync workflows from pkg-template" 2>&1 | sed 's/^/ /' - - if [[ "${{ inputs.confirmation }}" == "true" ]]; then - echo " ๐Ÿš€ Pushing changes and creating PR for $default_branch" - git push origin sync/pkg-template-workflows 2>&1 | sed 's/^/ /' - - pr_url=$(gh pr create --repo "$ORG/$repo" \ - --title "chore: sync workflows from pkg-template" \ - --body "This PR syncs the latest workflows from pkg-template." \ - --head sync/pkg-template-workflows \ - --base "$default_branch") - - PR_URLS+=("$pr_url") - echo " โœ… PR created: $pr_url" - else - echo " ๐Ÿ‘€ Dry-run mode - No PR will be created for $default_branch" - fi - - # Return to default branch before debian/* sync - git checkout "$default_branch" 2>&1 | sed 's/^/ /' - else - echo " โœจ No main branch changes needed for $repo" - fi - - # Sync pr-pre-post-merge.yml from pkg-template's debian/latest to every debian/* and qcom/debian/* branch - debian_branches=$(git branch -r | grep -E 'origin/(qcom/)?debian/' | sed 's|.*origin/||' | tr -d ' ') - - for debian_branch in $debian_branches; do - # Skip debian/latest itself (it's the source) - if [[ "$debian_branch" == "debian/latest" ]]; then - continue - fi - - echo " ๐ŸŒฟ Checking pr-pre-post-merge.yml on branch: $debian_branch" - safe_branch_name="${debian_branch//\//-}" - debian_sync_branch="sync/pkg-template-pr-merge-${safe_branch_name}" - - # Delete existing sync branch if from a previous run - if git ls-remote --exit-code --heads origin "$debian_sync_branch" > /dev/null 2>&1; then - echo " ๐Ÿงน Deleting existing $debian_sync_branch" - git push origin --delete "$debian_sync_branch" 2>&1 | sed 's/^/ /' - fi - - git checkout "$debian_branch" 2>&1 | sed 's/^/ /' - - isDebianDirty=false - if [[ -f ".github/workflows/pr-pre-post-merge.yml" ]]; then - if diff -q "$DEBIAN_LATEST_WORKFLOW_FILE" ".github/workflows/pr-pre-post-merge.yml" > /dev/null; then - echo " โœ… pr-pre-post-merge.yml is up to date on $debian_branch" - else - echo " โŒ pr-pre-post-merge.yml differs on $debian_branch" - cp "$DEBIAN_LATEST_WORKFLOW_FILE" ".github/workflows/pr-pre-post-merge.yml" - isDebianDirty=true - fi - else - echo " + Creating pr-pre-post-merge.yml on $debian_branch (missing)" - mkdir -p ".github/workflows" - cp "$DEBIAN_LATEST_WORKFLOW_FILE" ".github/workflows/pr-pre-post-merge.yml" - isDebianDirty=true - fi - - if [[ "$isDebianDirty" == "true" ]]; then - git checkout -b "$debian_sync_branch" 2>&1 | sed 's/^/ /' - git add .github/workflows/pr-pre-post-merge.yml - git commit -s -m "chore: sync pr-pre-post-merge.yml from pkg-template debian/latest" 2>&1 | sed 's/^/ /' - - if [[ "${{ inputs.confirmation }}" == "true" ]]; then - echo " ๐Ÿš€ Pushing changes and creating PR for $debian_branch" - git push origin "$debian_sync_branch" 2>&1 | sed 's/^/ /' - - pr_url=$(gh pr create --repo "$ORG/$repo" \ - --title "chore: sync pr-pre-post-merge.yml from pkg-template debian/latest" \ - --body "This PR syncs \`pr-pre-post-merge.yml\` from the \`debian/latest\` branch of pkg-template." \ - --head "$debian_sync_branch" \ - --base "$debian_branch") - - PR_URLS+=("$pr_url") - echo " โœ… PR created: $pr_url" - else - echo " ๐Ÿ‘€ Dry-run mode - No PR will be created for $debian_branch" - fi - fi - done - - cd .. - done - - # Output summary of created PRs - if [[ "${#PR_URLS[@]}" -gt 0 ]]; then - echo "๐ŸŽ‰ Created PRs for the following repositories:" - for pr_url in "${PR_URLS[@]}"; do - echo " - $pr_url" - done - fi \ No newline at end of file