Package camera-streamer-stack #7
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: "Package camera-streamer-stack" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| debian_revision: | |
| description: "Debian revision to use" | |
| required: false | |
| default: "1" | |
| jobs: | |
| package: | |
| name: "Package" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| package-version: ${{ steps.version.outputs.package-version }} | |
| build-date: ${{ steps.version.outputs.build-date }} | |
| git-hash: ${{ steps.version.outputs.git-hash }} | |
| steps: | |
| - name: "⬇ Checkout" | |
| uses: actions/checkout@v3 | |
| - name: 🏗 Set up Python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Install termux-create-package | |
| run: | | |
| export install_path="/usr/local/bin" | |
| sudo mkdir -p "$install_path" | |
| sudo curl -L 'https://github.com/termux/termux-create-package/releases/latest/download/termux-create-package' -o "$install_path/termux-create-package" | |
| sudo chmod 755 "$install_path/termux-create-package" | |
| - name: Prepare version | |
| id: version | |
| run: | | |
| today=$(date +"%Y%m%d") | |
| echo "build-date=$today" >> $GITHUB_OUTPUT | |
| revision="${{ github.event.inputs.debian_revision }}" | |
| hash=$(git rev-parse --short HEAD) | |
| echo "git-hash=$hash" >> $GITHUB_OUTPUT | |
| version="0~git$today+$hash.bullseye-$revision" | |
| echo "package-version-bullseye=$version" >> $GITHUB_OUTPUT | |
| version="0~git$today+$hash.bookworm-$revision" | |
| echo "package-version-bookworm=$version" >> $GITHUB_OUTPUT | |
| - name: Build packages | |
| run: | | |
| termux-create-package --pkg-version=${{ steps.version.outputs.package-version-bullseye }} manifest-bullseye-raspi.json | |
| termux-create-package --pkg-version=${{ steps.version.outputs.package-version-bookworm }} manifest-bookworm-raspi.json | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: camera-streamer-stack.deb | |
| path: camera-streamer-stack*.deb | |
| release: | |
| name: "Release" | |
| runs-on: ubuntu-latest | |
| needs: package | |
| outputs: | |
| release-assets: ${{ steps.create_release.outputs.assets }} | |
| steps: | |
| - name: Download deb artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: camera-streamer-stack.deb | |
| - name: "📝 Prepare release" | |
| run: | | |
| revision="${{ github.event.inputs.debian_revision }}" | |
| package_version="${{ needs.package.outputs.package-version }}" | |
| build_date="${{ needs.package.outputs.build-date }}" | |
| hash="${{ needs.package.outputs.git-hash }}" | |
| RELEASE_NAME="camera-streamer-stack $package_version" | |
| echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV | |
| RELEASE_TAG="$build_date-$revision" | |
| echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV | |
| cat > release.md << EOF | |
| Built from commit $hash. | |
| EOF | |
| - name: "🔖 Create release & attach export" | |
| uses: softprops/action-gh-release@v1 | |
| id: create_release | |
| with: | |
| name: "${{ env.RELEASE_NAME }}" | |
| tag_name: "${{ env.RELEASE_TAG }}" | |
| body_path: "release.md" | |
| fail_on_unmatched_files: true | |
| files: | | |
| camera-streamer-stack*.deb | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| notify: | |
| name: "Notify" | |
| runs-on: ubuntu-latest | |
| needs: release | |
| steps: | |
| - name: "♻ Prepare data" | |
| run: | | |
| cat > assets.json <<EOF | |
| ${{ needs.release.outputs.release-assets }} | |
| EOF | |
| URLS=$(jq -r '.[].browser_download_url' assets.json | tr '\n' ' ') | |
| echo "DEB_URLS=$URLS" >> $GITHUB_ENV | |
| - name: "📨 Notify apt repo" | |
| uses: peter-evans/repository-dispatch@v2 | |
| with: | |
| token: ${{ secrets.REPO_DISPATCH_ACCESS }} | |
| repository: OctoPrint/apt.octoprint.org | |
| event-type: add-package | |
| client-payload: '{"urls": "${{ env.DEB_URLS }}", "component": "rpi"}' |