Rolling Build #60
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: Rolling Build | |
| on: | |
| schedule: | |
| - cron: '0 2 * * 1,3,6' | |
| workflow_dispatch: | |
| jobs: | |
| build-stable: | |
| runs-on: ubuntu-latest | |
| container: { image: "fedora:latest", options: "--privileged" } | |
| steps: | |
| - name: Install dependencies | |
| run: dnf install -y flatpak flatpak-builder git rsync gpg | |
| - uses: actions/checkout@v4 | |
| - name: Import GPG key | |
| run: | | |
| echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import | |
| echo "GPG_KEY_ID=$(gpg --list-keys --with-colons | grep '^pub' | head -n 1 | cut -d: -f5)" >> $GITHUB_ENV | |
| - name: Add Flathub | |
| run: | | |
| for i in {1..5}; do | |
| flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && break || \ | |
| echo "Retry $i: Failed to connect to Flathub, retrying in 5s..." && sleep 5; | |
| done | |
| - name: Build Stable | |
| run: | | |
| BUILD_ID=$(date +%Y%m%d) | |
| BRANCH_NAME="v1.0" | |
| sed -i "s/__BUILD__/${BUILD_ID}/g" graphics.friction.Friction.json | |
| sed -i "s/__BRANCH__/${BRANCH_NAME}/g" graphics.friction.Friction.json | |
| flatpak-builder --user --install-deps-from=flathub --force-clean build-dir graphics.friction.Friction.json --default-branch=stable | |
| flatpak build-export --gpg-sign=${{ env.GPG_KEY_ID }} repo build-dir stable | |
| - name: Cleanup | |
| if: always() | |
| run: rm -rf /github/home/.gnupg | |
| - name: Upload Stable Repo | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: repo-stable | |
| path: repo/ | |
| build-devel: | |
| runs-on: ubuntu-latest | |
| container: { image: "fedora:latest", options: "--privileged" } | |
| steps: | |
| - name: Install dependencies | |
| run: dnf install -y flatpak flatpak-builder git rsync gpg | |
| - uses: actions/checkout@v4 | |
| - name: Import GPG key | |
| run: | | |
| echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import | |
| echo "GPG_KEY_ID=$(gpg --list-keys --with-colons | grep '^pub' | head -n 1 | cut -d: -f5)" >> $GITHUB_ENV | |
| - name: Add Flathub | |
| run: | | |
| for i in {1..5}; do | |
| flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo && break || \ | |
| echo "Retry $i: Failed to connect to Flathub, retrying in 5s..." && sleep 5; | |
| done | |
| - name: Build Devel | |
| run: | | |
| BUILD_ID=$(date +%Y%m%d) | |
| BRANCH_NAME="main" | |
| sed -i "s/__BUILD__/${BUILD_ID}/g" graphics.friction.Friction.json | |
| sed -i "s/__BRANCH__/${BRANCH_NAME}/g" graphics.friction.Friction.json | |
| flatpak-builder --user --install-deps-from=flathub --force-clean build-dir graphics.friction.Friction.json --default-branch=devel | |
| flatpak build-export --gpg-sign=${{ env.GPG_KEY_ID }} repo build-dir devel | |
| - name: Cleanup | |
| if: always() | |
| run: rm -rf /github/home/.gnupg | |
| - name: Upload Devel Repo | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: repo-devel | |
| path: repo/ | |
| deploy: | |
| needs: [build-stable, build-devel] | |
| runs-on: ubuntu-latest | |
| container: { image: "fedora:latest", options: "--privileged" } | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Install dependencies | |
| run: dnf install -y flatpak git rsync gpg | |
| - uses: actions/checkout@v4 | |
| - name: Import GPG key | |
| run: | | |
| echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import | |
| echo "GPG_KEY_ID=$(gpg --list-keys --with-colons | grep '^pub' | head -n 1 | cut -d: -f5)" >> $GITHUB_ENV | |
| - name: Download Stable | |
| uses: actions/download-artifact@v4 | |
| with: { name: repo-stable, path: final-repo } | |
| - name: Download Devel | |
| uses: actions/download-artifact@v4 | |
| with: { name: repo-devel, path: final-repo } | |
| - name: Finalize | |
| run: | | |
| flatpak build-update-repo --gpg-sign=${{ env.GPG_KEY_ID }} final-repo | |
| cp *.flatpakref *.flatpakrepo final-repo/ | |
| cp index.md final-repo/ | |
| cp _config.yml final-repo/ | |
| cp CNAME final-repo/ | |
| - name: Cleanup | |
| if: always() | |
| run: rm -rf /github/home/.gnupg | |
| - name: Deploy | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: final-repo | |
| branch: gh-pages | |
| clean: true |