Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
  • Loading branch information
krystian-hebel committed Oct 4, 2023
1 parent f52c598 commit 241b2f5
Showing 1 changed file with 107 additions and 8 deletions.
115 changes: 107 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,110 @@ on:
- '*'

jobs:
qubes-dom0-package:
uses: TrenchBoot/.github/.github/workflows/qubes-dom0-package.yml@master
with:
base-commit: '62819a6fdf58d3d3c47aff5096dea9fb88ce1d53'
patch-start: 0000
qubes-component: 'antievilmaid'
spec-pattern: '/^Source0:/'
spec-file: 'anti-evil-maid'
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: TrenchBoot/.github
path: shared
ref: ${{ github.job_workflow_sha }}

- name: Cache Docker image and dom0 stuff
uses: actions/cache@v3
id: docker-cache
with:
path: |
/tmp/qubes-fedora-builder.tar
/tmp/cache/dom0.tar
key: |
${{ hashFiles('shared/qubes-builder-docker/*') }}-docker-container
- name: Load Docker image
if: steps.docker-cache.outputs.cache-hit == 'true'
run: |
docker load --input /tmp/qubes-fedora-builder.tar
- name: Build Docker image (optional)
if: steps.docker-cache.outputs.cache-hit != 'true'
uses: docker/build-push-action@v4
with:
tags: qubes-fedora-builder:latest
context: shared/qubes-builder-docker

- name: Export Docker image (optional)
if: steps.docker-cache.outputs.cache-hit != 'true'
run: |
docker save --output /tmp/qubes-fedora-builder.tar \
qubes-fedora-builder:latest
- name: Prepare dom0 cache storage (optional)
if: steps.docker-cache.outputs.cache-hit != 'true'
run: |
mkdir --mode=777 /tmp/cache
- name: Apply patches
run: |
echo -e "#!/bin/bash\nmake -C /builder 'COMPONENTS=antievilmaid' get-sources" > "$GITHUB_WORKSPACE/entry.sh"
chmod +x "$GITHUB_WORKSPACE/entry.sh"
docker run --privileged \
-v "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" \
-w "$GITHUB_WORKSPACE" \
--entrypoint ./entry.sh \
qubes-fedora-builder:latest
ls $GITHUB_WORKSPACE
rm "$GITHUB_WORKSPACE/entry.sh"
patches=( $(git format-patch --start-number 1 62819a6fdf58d3d3c47aff5096dea9fb88ce1d53) )
git -C "$GITHUB_WORKSPACE" config user.email "test@example.com"
git -C "$GITHUB_WORKSPACE" config user.name "Test User"
git -C "$GITHUB_WORKSPACE" config gc.auto 0
git -C "$GITHUB_WORKSPACE" am ${patches[@]}
- name: Build and package
run: |
docker run --privileged \
-v /tmp/cache:/tmp/cache/ \
-v "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" \
-w "$GITHUB_WORKSPACE" \
-e "COMPONENT='antievilmaid'" \
-e "PATCH_START='1'" \
-e "BASE_COMMIT=62819a6fdf58d3d3c47aff5096dea9fb88ce1d53" \
-e "SPEC_PATTERN='/^Source0:/'" \
-e "SPEC_FILENAME='anti-evil-maid'" \
qubes-fedora-builder:latest
- 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' && startsWith(github.event.ref, 'refs/tags/')
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' && startsWith(github.event.ref, 'refs/tags/')
uses: ncipollo/release-action@v1.13.0
with:
artifacts: '*.rpm'
artifactErrorsFailBuild: true
bodyFile: "release-body.md"

0 comments on commit 241b2f5

Please sign in to comment.