|
| 1 | +name: Monitor libseccomp Releases |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * *' # Daily at midnight UTC |
| 6 | + workflow_dispatch: # Allow manual trigger |
| 7 | + |
| 8 | +permissions: |
| 9 | + issues: write |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + check-release: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Get current libseccomp version from Dockerfile |
| 20 | + id: current |
| 21 | + run: | |
| 22 | + CURRENT=$(grep 'LIBSECCOMP_VER' tools/devctr/Dockerfile | grep -oP "v[0-9.]+") |
| 23 | + echo "version=$CURRENT" >> $GITHUB_OUTPUT |
| 24 | + |
| 25 | + - name: Check for new libseccomp release |
| 26 | + id: latest |
| 27 | + run: | |
| 28 | + LATEST=$(curl -s https://api.github.com/repos/seccomp/libseccomp/releases/latest | jq -r '.tag_name') |
| 29 | + echo "version=$LATEST" >> $GITHUB_OUTPUT |
| 30 | +
|
| 31 | + - name: Check latest version is newer |
| 32 | + id: semver_check |
| 33 | + run: | |
| 34 | + CURRENT=$(echo ${{ steps.current.outputs.version }} | grep -oP "[0-9.]+") |
| 35 | + LATEST=$(echo ${{ steps.latest.outputs.version }} | grep -oP "[0-9.]+") |
| 36 | + if ! printf '%s\n%s' "$LATEST" "$CURRENT" | sort -VC && [ "$CURRENT" != "$LATEST" ]; then |
| 37 | + echo "is_newer=true" >> $GITHUB_OUTPUT; |
| 38 | + else |
| 39 | + echo "is_newer=false" >> $GITHUB_OUTPUT; |
| 40 | + fi |
| 41 | + |
| 42 | + - name: Check if issue exists |
| 43 | + if: steps.semver_check.outputs.is_newer == 'true' # New release has higher semantic version |
| 44 | + id: issue_check |
| 45 | + run: | |
| 46 | + ISSUES=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
| 47 | + "https://api.github.com/repos/${{ github.repository }}/issues?state=open&labels=dependencies" | \ |
| 48 | + jq -r --arg tag "${{ steps.latest.outputs.version }}" '[.[] | select(.title | contains("chore(deps): update libseccomp to \($tag)"))] | length') |
| 49 | + echo "exists=$ISSUES" >> $GITHUB_OUTPUT |
| 50 | +
|
| 51 | + - name: Create issue for new release |
| 52 | + id: create_issue |
| 53 | + if: steps.semver_check.outputs.is_newer == 'true' && steps.issue_check.outputs.exists == '0' # No existing issue for new version |
| 54 | + run: | |
| 55 | + gh issue create \ |
| 56 | + --title "chore(deps): update libseccomp to ${{ steps.latest.outputs.version }}" \ |
| 57 | + --body "$(cat <<EOF |
| 58 | + A new version of libseccomp has been released: **${{ steps.latest.outputs.version }}** |
| 59 | +
|
| 60 | + Current version in Dockerfile: **${{ steps.current.outputs.version }}** |
| 61 | +
|
| 62 | + Repository: https://github.com/seccomp/libseccomp/releases/tag/${{ steps.latest.outputs.version }} |
| 63 | +
|
| 64 | + Please review and consider updating Firecracker's dependency in \`tools/devctr/Dockerfile\`. |
| 65 | + EOF |
| 66 | + )" \ |
| 67 | + --label "dependencies" |
| 68 | + env: |
| 69 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments