a bare-bones limbo server in rust (mirror of https://github.com/xoogware/crawlspace)
1name: build-container
2on:
3 schedule:
4 - cron: "00 00 * * *"
5 workflow_dispatch:
6
7env:
8 IMAGE_NAME: crawlspace
9 IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
10
11jobs:
12 check-last-commit:
13 runs-on: ubuntu-24.04
14 name: Check last commit date
15 outputs:
16 run-approved: ${{ steps.confirm-run.outputs.run-approved }}
17 steps:
18 - uses: actions/checkout@v4
19 - id: confirm-run
20 continue-on-error: true
21 name: Check last commit is <24h old
22 if: ${{ github.event_name == 'schedule' }}
23 run: |
24 test -z $(git ref-list --after="24 hours" ${{ github.sha }}) && echo "run-approved=false" >> $GITHUB_OUTPUT
25
26 build-container:
27 name: Build and push container
28 runs-on: ubuntu-24.04
29 permissions:
30 contents: read
31 packages: write
32 needs: check-last-commit
33 if: ${{ needs.check-last-commit.outputs.run-approved != 'false' }}
34 steps:
35 - name: Checkout
36 uses: actions/checkout@v4
37
38 - name: Generate tag
39 id: generate-tags
40 run: |
41 echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
42 echo "date=$(date +%m%d%Y)" >> $GITHUB_OUTPUT
43
44 - name: Image Metadata
45 uses: docker/metadata-action@v4
46 with:
47 images: |
48 ${{ env.IMAGE_NAME }}
49
50 - name: Build image
51 id: build
52 uses: redhat-actions/buildah-build@v2
53 with:
54 containerfiles: |
55 ./Containerfile
56 image: ${{ env.IMAGE_NAME }}
57 labels: ${{ steps.meta.outputs.labels }}
58 oci: false
59 tags: |
60 ${{ steps.generate-tags.outputs.sha }}
61 ${{ steps.generate-tags.outputs.date }}
62 nightly
63
64 - name: Push
65 uses: redhat-actions/push-to-registry@v2
66 with:
67 image: ${{ steps.build.outputs.image }}
68 tags: ${{ steps.build.outputs.tags }}
69 registry: ${{ env.IMAGE_REGISTRY }}
70 username: ${{ github.actor }}
71 password: ${{ github.token }}
72