diff --git a/.github/workflows/release-iso.yml b/.github/workflows/release-iso.yml index ef80c1e..7168a57 100644 --- a/.github/workflows/release-iso.yml +++ b/.github/workflows/release-iso.yml @@ -1,47 +1,79 @@ +name: Build ISO + on: - push: - paths: - - 'boot_menu.yml' - - '.github/workflows/release-iso.yml' + schedule: + - cron: "0 0 1 * *" # Build & upload ISO every month + workflow_dispatch: + branches: + - main + paths: + - '.github/workflows/build_iso.yml' + +env: + IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true -name: release-iso jobs: - release-iso: - name: Generate and Release ISOs + build-iso: runs-on: ubuntu-latest permissions: - contents: write - container: - image: fedora:40 - options: --privileged + contents: read + packages: write + id-token: write + strategy: + fail-fast: false + matrix: + image_name: [mybluebuild] + major_version: [40] + image_tag: [latest] + steps: - - uses: actions/checkout@v4 - - name: Generate ISO - uses: ublue-os/isogenerator@1.0.9 - id: isogenerator - with: - image-name: ${{ github.event.repository.name }} - installer-repo: releases - installer-major-version: 40 - boot-menu-path: boot_menu.yml - - name: install github CLI + - name: Fetch current date + shell: bash run: | - sudo dnf install 'dnf-command(config-manager)' -y - sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo - sudo dnf install gh -y - - name: Upload ISO - env: - GITHUB_TOKEN: ${{ github.token }} + TIMESTAMP="$(date +%d-%m-%Y)" + echo "TIMESTAMP=${TIMESTAMP}" >> $GITHUB_ENV + + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Build ISO + uses: jasonn3/build-container-installer@v1.2.1 + id: build + with: + arch: x86_64 + version: ${{ matrix.major_version }} + image_repo: ${{ env.IMAGE_REGISTRY }} + image_name: ${{ matrix.image_name }} + image_tag: ${{ matrix.image_tag }} + variant: 'Silverblue' + enrollment_password: 'ublue-os' + secure_boot_key_url: 'https://github.com/ublue-os/akmods/raw/main/certs/public_key.der' + iso_name: ${{ matrix.image_name }}_${{ env.TIMESTAMP }}.iso + enable_cache_dnf: "false" + enable_cache_skopeo: "false" + enable_flatpak_dependencies: "false" + flatpak_remote_name: "flathub-system" + flatpak_remote_url: "https://flathub.org/repo/flathub.flatpakrepo" + + - name: Move ISO to Upload Directory + id: upload-directory + shell: bash run: | - if gh release list -R ${{ github.repository_owner }}/${{ github.event.repository.name }} | grep "auto-iso"; then - gh release view auto-iso -R ${{ github.repository_owner }}/${{ github.event.repository.name }} --json assets -q .assets[].name | xargs --no-run-if-empty -L 1 gh release delete-asset auto-iso -R ${{ github.repository_owner }}/${{ github.event.repository.name }} - gh release upload auto-iso ${{ steps.isogenerator.outputs.iso-path }} -R ${{ github.repository_owner }}/${{ github.event.repository.name }} --clobber - else - gh release create auto-iso ${{ steps.isogenerator.outputs.iso-path }} -t ISO -n "This is an automatically generated ISO release." -R ${{ github.repository_owner }}/${{ github.event.repository.name }} - fi - - name: Upload SHA256SUM - env: - GITHUB_TOKEN: ${{ github.token }} - run: - gh release upload auto-iso ${{ steps.isogenerator.outputs.sha256sum-path }} -R ${{ github.repository_owner }}/${{ github.event.repository.name }} --clobber + ISO_UPLOAD_DIR=${{ github.workspace }}/upload + mkdir ${ISO_UPLOAD_DIR} + mv ${{ steps.build.outputs.iso_path }}/${{ steps.build.outputs.iso_name }} ${ISO_UPLOAD_DIR} + mv ${{ steps.build.outputs.iso_path }}/${{ steps.build.outputs.iso_name }}-CHECKSUM ${ISO_UPLOAD_DIR} + echo "iso-upload-dir=${ISO_UPLOAD_DIR}" >> $GITHUB_OUTPUT + + - name: Upload ISO to archive.org + uses: qoijjj/internet-archive-upload@v7 + with: + access-key: ${{ secrets.IA_ACCESS_KEY }} + secret-key: ${{ secrets.IA_SECRET_KEY }} + identifier: ${{ matrix.image_name }}_${{ env.TIMESTAMP }} + files: ${{ steps.upload-directory.outputs.iso-upload-dir }}