Skip to content

Watch upstream releases #109

Watch upstream releases

Watch upstream releases #109

name: Watch upstream releases
on:
schedule:
# Run daily at 6:00 UTC
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
check-upstream:
name: Check for new releases
runs-on: ubuntu-22.04
outputs:
release_version: ${{ steps.check.outputs.release_version }} # Latest overall release (e.g., 1.5.35)
daemon_version: ${{ steps.check.outputs.daemon_version }} # Daemon binary version (e.g., 1.5.21)
current_recipe: ${{ steps.check.outputs.current_recipe }} # Current recipe version (daemon)
current_release: ${{ steps.check.outputs.current_release }} # Tracked release version (from IOTEDGE_RELEASE)
template: ${{ steps.check.outputs.template }} # Yocto template for the tracked LTS line (scarthgap/wrynose)
needs_update: ${{ steps.check.outputs.needs_update }} # Whether recipe update is needed
is_significant: ${{ steps.check.outputs.is_significant }} # Whether this is a daemon update (not Docker-only)
update_type: ${{ steps.check.outputs.update_type }} # none, significant, or docker-only
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Check upstream releases
id: check
run: |
# Run the check script and capture output
output=$(./scripts/check-upstream.sh)
# Parse key=value output and set as GitHub outputs
while IFS='=' read -r key value; do
echo "${key}=${value}" >> "$GITHUB_OUTPUT"
done <<< "$output"
update-recipes:
name: Update recipes
needs: check-upstream
if: needs.check-upstream.outputs.needs_update == 'true' && needs.check-upstream.outputs.is_significant == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 60
container:
# Release-neutral devcontainer (host tools only; OE fetches the per-
# template toolchain). The Yocto line comes from --template below.
image: ghcr.io/azure/meta-iotedge-devcontainer:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Fix git permissions
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Update and validate recipes
run: |
# Pass the template for the LTS line being updated (1.6.* -> wrynose,
# 1.5.* -> scarthgap), derived by check-upstream from the lts
# channel's daemon version. --clean is scoped to that line, so the
# other LTS line's recipes are left untouched during overlap.
./scripts/update-recipes.sh \
--iotedge-version "${{ needs.check-upstream.outputs.release_version }}" \
--template "${{ needs.check-upstream.outputs.template }}" \
--clean
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
title: "Update to IoT Edge ${{ needs.check-upstream.outputs.release_version }}"
commit-message: |
Update IoT Edge recipes for ${{ needs.check-upstream.outputs.release_version }}
IoT Edge daemon version: ${{ needs.check-upstream.outputs.daemon_version }}
branch: automation/upstream-update
delete-branch: true
labels: |
automated
upstream-update
body: |
## Automated Upstream Update
This PR was automatically created by the upstream release watcher.
### Versions
| Component | Current | New |
|-----------|---------|-----|
| Release | ${{ needs.check-upstream.outputs.current_release }} | ${{ needs.check-upstream.outputs.release_version }} |
| Daemon | - | ${{ needs.check-upstream.outputs.daemon_version }} |
### Validation Checklist
- [ ] CI build passes
- [ ] QEMU validation passes
### After Merging
Create a release by running:
```bash
git pull origin main
git tag ${{ needs.check-upstream.outputs.release_version }}
git push origin ${{ needs.check-upstream.outputs.release_version }}
```
This will trigger the [release workflow](../actions/workflows/release.yml) to build and publish packages.
### Release Notes
- [Azure IoT Edge ${{ needs.check-upstream.outputs.release_version }}](https://github.com/Azure/azure-iotedge/releases/tag/${{ needs.check-upstream.outputs.release_version }})
# Notify when recipes are current (daemon) but there's a newer Docker-only release
notify-docker-only:
name: Notify Docker-only update
needs: check-upstream
# Notify only when the upstream release is a Docker-only update that
# we haven't already tracked via IOTEDGE_RELEASE.
if: needs.check-upstream.outputs.update_type == 'docker-only'
runs-on: ubuntu-22.04
permissions:
issues: write
steps:
- name: Create issue for Docker-only update
uses: actions/github-script@v9
with:
script: |
const releaseVersion = '${{ needs.check-upstream.outputs.release_version }}';
const daemonVersion = '${{ needs.check-upstream.outputs.daemon_version }}';
const currentRecipe = '${{ needs.check-upstream.outputs.current_recipe }}';
// Check if there's already an open issue for this release
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'docker-only-update'
});
const existingIssue = issues.data.find(i => i.title.includes(releaseVersion));
if (existingIssue) {
console.log(`Issue already exists for ${releaseVersion}`);
return;
}
const body = [
'A new IoT Edge release is available, but it only contains Docker image updates.',
'',
`**Latest Release:** ${releaseVersion}`,
`**Daemon Version:** ${daemonVersion} (unchanged)`,
`**Current Recipe:** ${currentRecipe}`,
'',
'No recipe updates are needed since the daemon binaries haven\'t changed.',
'',
'This issue is for tracking purposes only. Close it once acknowledged.',
'',
`[View release notes](https://github.com/Azure/azure-iotedge/releases/tag/${releaseVersion})`
].join('\n');
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `IoT Edge ${releaseVersion} released (Docker images only)`,
labels: ['docker-only-update', 'no-action-needed'],
body: body
});