Skip to content

Commit cfb577e

Browse files
committed
Merge master branch
2 parents e716636 + 9029cf8 commit cfb577e

File tree

13 files changed

+684
-281
lines changed

13 files changed

+684
-281
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/" # Location of package manifests
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "pip"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Manual PR Publish Trigger
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
jobs:
8+
pr-label-trigger:
9+
# This job only runs if the event is a label being added to a Pull Request.
10+
if: github.event.issue.pull_request
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Dispatch build for PR branch
14+
if: github.event.label.name == 'publish-qt5' || github.event.label.name == 'publish-qt6'
15+
uses: actions/github-script@v8
16+
with:
17+
script: |
18+
const label = context.payload.label.name;
19+
const prNumber = context.issue.number;
20+
21+
// 1. Determine which workflow to call and its parameters
22+
const workflow_id = (label === 'publish-qt5') ? 'publish-daily-qt5.yml' : 'publish-daily-qt6.yml';
23+
24+
// 2. Check user's permission level
25+
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
26+
owner: context.repo.owner, repo: context.repo.repo, username: context.actor });
27+
if (!['admin', 'write', 'maintain'].includes(permission.permission)) {
28+
return core.setFailed(`User @${context.actor} does not have sufficient permission.`);
29+
}
30+
31+
// 3. Get the PR's source branch
32+
const { data: pr } = await github.rest.pulls.get({
33+
owner: context.repo.owner, repo: context.repo.repo, pull_number: prNumber });
34+
const prBranch = pr.head.ref;
35+
36+
// 4. Construct the Snap Store release channel for this PR
37+
const releaseChannel = `edge/pr${prNumber}`;
38+
39+
// 5. Trigger the target workflow with the correct inputs
40+
console.log(`Triggering '${workflow_id}' for PR branch '${prBranch}' to be published to '${releaseChannel}'`);
41+
await github.rest.actions.createWorkflowDispatch({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
workflow_id: workflow_id,
45+
ref: 'main', // The dispatch action must be triggered from a branch that has the workflow file
46+
inputs: {
47+
checkout_ref: prBranch,
48+
release_channel: releaseChannel
49+
}
50+
});
51+
52+
// 6. Add a confirmation comment to the PR
53+
await github.rest.issues.createComment({
54+
owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber,
55+
body: `✅ \`${label}\` build triggered for branch \`${prBranch}\` by @${context.actor}. The snap will be published to the \`${releaseChannel}\` channel.`
56+
});
57+
58+
- name: Remove trigger label
59+
if: success() && (github.event.label.name == 'publish-qt5' || github.event.label.name == 'publish-qt6')
60+
uses: actions/github-script@v8
61+
with:
62+
script: |
63+
await github.rest.issues.removeLabel({
64+
owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, name: context.payload.label.name });

.github/workflows/promote-to-beta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
publish_amd64:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v6
1313
- name: install snapcraft
1414
run: sudo snap install snapcraft --classic
1515
- name: promote from edge to beta
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish Daily Qt 5
2+
3+
on:
4+
schedule:
5+
# Runs every day at 02:00 UTC to avoid overlapping with the Qt 6 build.
6+
- cron: "0 2 * * *"
7+
workflow_dispatch:
8+
inputs:
9+
checkout_ref:
10+
description: 'The git ref to check out.'
11+
required: false
12+
type: string
13+
release_channel:
14+
description: 'The Snap Store channel to release to. Defaults to edge/qt5.'
15+
required: false
16+
type: string
17+
default: 'edge/qt5'
18+
19+
20+
jobs:
21+
publish:
22+
uses: ./.github/workflows/reusable-publish.yml
23+
with:
24+
os: ubuntu-22.04
25+
arch: amd64
26+
# If a checkout_ref is provided by the dispatch, use it.
27+
checkout_ref: ${{ github.event.inputs.checkout_ref || 'core22-kde-neon' }}
28+
release_channel: ${{ github.event.inputs.release_channel || 'edge/qt5' }}
29+
secrets:
30+
store_login: ${{ secrets.STORE_LOGIN }}

.github/workflows/publish-daily-qt6.yml

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,38 @@ name: Publish Daily Qt 6
22

33
on:
44
schedule:
5-
- cron: "0 0 * * *" # Every day at 0:00
6-
workflow_dispatch: # or manually
7-
8-
env:
9-
LOG_PATH: /home/runner/.local/state/snapcraft/log/
5+
# Runs every day at 00:00 UTC.
6+
- cron: "0 0 * * *"
7+
workflow_dispatch:
8+
inputs:
9+
checkout_ref:
10+
description: 'The git ref to check out. Defaults to the default branch.'
11+
required: false
12+
type: string
13+
release_channel:
14+
description: 'The Snap Store channel to release to. Defaults to edge.'
15+
required: false
16+
type: string
17+
default: 'edge'
1018

1119
jobs:
12-
publish_amd64:
13-
runs-on: ubuntu-24.04
14-
steps:
15-
- name: Checkout packaging repository
16-
uses: actions/checkout@v4
17-
with:
18-
ref: core24-kde-neon-6
19-
20-
- name: Install Snapcraft and build snap
21-
uses: snapcore/action-build@v1
22-
with:
23-
snapcraft-channel: latest/edge
24-
snapcraft-args: --verbose
25-
id: snapcraft
26-
continue-on-error: true
27-
28-
- name: Upload log artifact
29-
uses: actions/upload-artifact@v4
30-
with:
31-
name: snapcraft-log
32-
path: ${{ env.LOG_PATH }}/*
33-
34-
- name: Publish snap
35-
continue-on-error: true
36-
uses: snapcore/action-publish@v1
37-
if: ${{ (github.repository_owner == 'FreeCAD') && (steps.snapcraft.outcome == 'success') }}
38-
env:
39-
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
40-
with:
41-
snap: ${{ steps.snapcraft.outputs.snap }}
42-
release: edge/qt6
43-
44-
- name: Upload snap package artifact
45-
if: ${{ steps.snapcraft.outcome == 'success' }}
46-
uses: actions/upload-artifact@v4
47-
with:
48-
name: snap-package
49-
path: ${{ steps.snapcraft.outputs.snap }}
20+
publish:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- os: ubuntu-24.04
26+
arch: amd64
27+
- os: ubuntu-24.04-arm
28+
arch: arm64
29+
uses: ./.github/workflows/reusable-publish.yml
30+
with:
31+
os: ${{ matrix.os }}
32+
# Pass the arch from the matrix to the reusable workflow
33+
arch: ${{ matrix.arch }}
34+
# If a checkout_ref is provided by the dispatch, use it. Otherwise, use nothing (which means default branch).
35+
checkout_ref: ${{ github.event.inputs.checkout_ref }}
36+
# Use the release_channel from the dispatch input. The default is already 'edge'.
37+
release_channel: ${{ github.event.inputs.release_channel }}
38+
secrets:
39+
store_login: ${{ secrets.STORE_LOGIN }}

.github/workflows/publish-daily.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/publish-release.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,37 @@ on:
44
push:
55
branches:
66
- stable
7+
workflow_dispatch:
8+
inputs:
9+
checkout_ref:
10+
description: 'The git ref to check out. Defaults to the stable branch.'
11+
required: false
12+
type: string
13+
default: 'stable'
14+
release_channel:
15+
description: 'The Snap Store channel to release to. Defaults to the candidate channel.'
16+
required: false
17+
type: string
18+
default: 'candidate'
719

820
jobs:
9-
publish_amd64:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v4
13-
- uses: canonical/action-build@v1
14-
id: build
15-
with:
16-
snapcraft-args: "--enable-experimental-extensions"
17-
- uses: snapcore/action-publish@v1
18-
env:
19-
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
20-
with:
21-
snap: ${{ steps.build.outputs.snap }}
22-
release: candidate
21+
publish:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- os: ubuntu-24.04
27+
arch: amd64
28+
- os: ubuntu-24.04-arm
29+
arch: arm64
30+
uses: ./.github/workflows/reusable-publish.yml
31+
with:
32+
os: ${{ matrix.os }}
33+
# Pass the arch from the matrix to the reusable workflow
34+
arch: ${{ matrix.arch }}
35+
# If a checkout_ref is provided by the dispatch, use it. Otherwise, use nothing (which means stable branch).
36+
checkout_ref: ${{ github.event.inputs.checkout_ref }}
37+
# Use the release_channel from the dispatch input. The default is already 'candidate'.
38+
release_channel: ${{ github.event.inputs.release_channel }}
39+
secrets:
40+
store_login: ${{ secrets.STORE_LOGIN }}

0 commit comments

Comments
 (0)