Check for new librtmp2 release #485
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check for new librtmp2 release | |
| on: | |
| schedule: | |
| - cron: "*/5 * * * *" | |
| workflow_dispatch: | |
| permissions: | |
| actions: write | |
| contents: read | |
| concurrency: | |
| group: check-librtmp2-release | |
| cancel-in-progress: false | |
| jobs: | |
| check: | |
| name: Check latest release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.release.outputs.version }} | |
| tag: ${{ steps.release.outputs.tag }} | |
| apt_needed: ${{ steps.status.outputs.apt_needed }} | |
| alpine_needed: ${{ steps.status.outputs.alpine_needed }} | |
| steps: | |
| - name: Checkout package repository | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| fetch-depth: 1 | |
| - name: Resolve latest librtmp2 release | |
| id: release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| run: | | |
| tag="$(gh api repos/OpenRTMP/librtmp2/releases/latest --jq '.tag_name')" | |
| if [[ -z "$tag" ]]; then | |
| echo "No published librtmp2 release was found." >&2 | |
| exit 1 | |
| fi | |
| version="${tag#v}" | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| echo "Latest published librtmp2 release: $tag" | |
| - name: Check repository and running workflows | |
| id: status | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| VERSION: ${{ steps.release.outputs.version }} | |
| shell: bash | |
| run: | | |
| apt_published=false | |
| alpine_published=false | |
| chmod +x scripts/check-librtmp2-package-completeness.sh | |
| if scripts/check-librtmp2-package-completeness.sh apt; then | |
| apt_published=true | |
| fi | |
| if scripts/check-librtmp2-package-completeness.sh alpine; then | |
| alpine_published=true | |
| fi | |
| apt_running="$(gh run list \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --workflow build-librtmp2-packages.yml \ | |
| --limit 20 \ | |
| --json status \ | |
| --jq '[.[] | select(.status == "queued" or .status == "in_progress" or .status == "waiting" or .status == "pending" or .status == "requested")] | length')" | |
| alpine_running="$(gh run list \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --workflow build-librtmp2-alpine.yml \ | |
| --limit 20 \ | |
| --json status \ | |
| --jq '[.[] | select(.status == "queued" or .status == "in_progress" or .status == "waiting" or .status == "pending" or .status == "requested")] | length')" | |
| apt_needed=true | |
| alpine_needed=true | |
| if [[ "$apt_published" == true || "$apt_running" -gt 0 ]]; then | |
| apt_needed=false | |
| fi | |
| if [[ "$alpine_published" == true || "$alpine_running" -gt 0 ]]; then | |
| alpine_needed=false | |
| fi | |
| echo "apt_needed=$apt_needed" >> "$GITHUB_OUTPUT" | |
| echo "alpine_needed=$alpine_needed" >> "$GITHUB_OUTPUT" | |
| echo "APT: complete=$apt_published running=$apt_running needed=$apt_needed" | |
| echo "Alpine: complete=$alpine_published running=$alpine_running needed=$alpine_needed" | |
| dispatch-apt: | |
| name: Start APT package workflow | |
| needs: check | |
| if: needs.check.outputs.apt_needed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Dispatch APT build | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| VERSION: ${{ needs.check.outputs.version }} | |
| shell: bash | |
| run: | | |
| gh workflow run build-librtmp2-packages.yml \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --ref main \ | |
| -f version="$VERSION" | |
| echo "Started APT packages for librtmp2 $VERSION." | |
| dispatch-alpine: | |
| name: Start Alpine package workflow | |
| needs: check | |
| if: needs.check.outputs.alpine_needed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Dispatch Alpine build | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| VERSION: ${{ needs.check.outputs.version }} | |
| shell: bash | |
| run: | | |
| gh workflow run build-librtmp2-alpine.yml \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --ref main \ | |
| -f version="$VERSION" | |
| echo "Started Alpine packages for librtmp2 $VERSION." | |
| summary: | |
| name: Release check summary | |
| needs: [check, dispatch-apt, dispatch-alpine] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Write summary | |
| shell: bash | |
| run: | | |
| { | |
| echo "## librtmp2 release check" | |
| echo | |
| echo "- Release: \`${{ needs.check.outputs.tag }}\`" | |
| echo "- APT build required: \`${{ needs.check.outputs.apt_needed }}\`" | |
| echo "- Alpine build required: \`${{ needs.check.outputs.alpine_needed }}\`" | |
| echo | |
| echo "A repository is considered published only when every configured package target and its repository metadata are present." | |
| } >> "$GITHUB_STEP_SUMMARY" |