diff --git a/.github/workflows/qubes-dom0-packagev2.yml b/.github/workflows/qubes-dom0-packagev2.yml new file mode 100644 index 0000000..083d8dd --- /dev/null +++ b/.github/workflows/qubes-dom0-packagev2.yml @@ -0,0 +1,104 @@ +name: Test build and package QubesOS RPMs + +on: + workflow_call: + inputs: + qubes-component: + description: > + Name of QubesOS component as recognized by its build system. + required: true + type: string + git-url: + description: > + URL of GitHub repository to be used by builder. Use same format as + GITHUB_REPOSITORY, e.g. `TrenchBoot/antievilmaid`. + required: false + type: string + +jobs: + build-and-package: + runs-on: ubuntu-latest + name: Compile and package as QubesOS RPM + permissions: + # for publishing releases + contents: write + + steps: +# - uses: actions/checkout@v3 +# with: +# fetch-depth: 100 # need history for `git format-patch` + + - uses: actions/checkout@v3 + with: + repository: QubesOS/qubes-builderv2 +# path: shared + + - name: Cache Docker image and dom0 stuff + uses: actions/cache@v3 + id: docker-cache + with: + path: | + /tmp/qubes-builder-fedora.tar + /tmp/cache/dom0.tar + key: | + ${{ hashFiles('tools/*') }}-docker-container + + - name: Load Docker image + if: steps.docker-cache.outputs.cache-hit == 'true' + run: | + docker load --input /tmp/qubes-builder-fedora.tar + + - name: Build Docker image (optional) + if: steps.docker-cache.outputs.cache-hit != 'true' + run: | + tools/generate-container-image.sh docker + + - name: Export Docker image (optional) + if: steps.docker-cache.outputs.cache-hit != 'true' + run: | + docker save --output /tmp/qubes-builder-fedora.tar \ + qubes-builder-fedora:latest + + - name: Prepare dom0 cache storage (optional) + if: steps.docker-cache.outputs.cache-hit != 'true' + run: | + mkdir --mode=777 /tmp/cache + + - name: Build and package + run: | +# chmod -R 777 . +# docker run --privileged \ +# -v /tmp/cache:/tmp/cache/ \ +# -v "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" \ +# -w "$GITHUB_WORKSPACE" \ +# qubes-builder-fedora:latest \ +# /bin/bash -c "sudo dnf install -y openssl python3-click python3-pathspec python3-packaging \ +# && + ./qb --debug --verbose --builder-conf example-configs/builder-devel.yml -o git.prefix=${{ inputs.git-url }} -c ${{ inputs.qubes-component }} package fetch prep build + + - name: Save built packages + uses: actions/upload-artifact@v3 + with: + name: qubesos.dom0.fc37-${{ inputs.qubes-component }}-${{ github.sha }} + path: '*.rpm' + + - name: Construct release's description + if: github.event_name == 'push' && github.ref_type == 'tag' + run: | + for artifact in *.rpm; do + echo "### $artifact" >> release-body.md + echo '```' >> release-body.md + echo "wget --quiet '${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/$artifact'" >> release-body.md + echo '```' >> release-body.md + echo '```' >> release-body.md + echo "curl --remote-name '${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/$artifact'" >> release-body.md + echo '```' >> release-body.md + done + + - name: Create release for a new tag + if: github.event_name == 'push' && github.ref_type == 'tag' + uses: ncipollo/release-action@v1.13.0 + with: + artifacts: '*.rpm' + artifactErrorsFailBuild: true + bodyFile: "release-body.md"