Skip to content

Commit 1e3bd6f

Browse files
committed
chore: initialize repository
0 parents  commit 1e3bd6f

File tree

6 files changed

+947
-0
lines changed

6 files changed

+947
-0
lines changed

.github/workflows/buildah.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
name: Build
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- '*/Containerfile'
10+
- '.github/workflows/build.yml'
11+
workflow_dispatch:
12+
inputs:
13+
image:
14+
description: 'Image to build (leave empty for all)'
15+
required: false
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
jobs:
22+
detect:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
images: ${{ steps.find.outputs.images }}
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 2
31+
32+
- name: Find changed images
33+
id: find
34+
run: |
35+
if [ -n "${{ inputs.image }}" ]; then
36+
echo "images=[\"${{ inputs.image }}\"]" >> "$GITHUB_OUTPUT"
37+
elif [ "${{ github.event_name }}" = "push" ]; then
38+
changed=$(git diff --name-only HEAD~1 HEAD | grep '/Containerfile' | cut -d'/' -f1 | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))')
39+
if [ "$changed" = "[]" ]; then
40+
changed=$(find . -maxdepth 2 -name Containerfile | cut -d'/' -f2 | jq -R -s -c 'split("\n") | map(select(length > 0))')
41+
fi
42+
echo "images=$changed" >> "$GITHUB_OUTPUT"
43+
fi
44+
45+
build:
46+
needs: detect
47+
if: needs.detect.outputs.images != '[]'
48+
runs-on: ubuntu-latest
49+
strategy:
50+
matrix:
51+
image: ${{ fromJson(needs.detect.outputs.images) }}
52+
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
57+
- name: Run pre-commit
58+
uses: pre-commit/action@v3.0.1
59+
60+
- name: Build image
61+
uses: redhat-actions/buildah-build@v2
62+
with:
63+
context: ${{ matrix.image }}
64+
containerfiles: ${{ matrix.image }}/Containerfile
65+
image: ${{ matrix.image }}
66+
tags: latest ${{ github.sha }}
67+
extra-args: --squash
68+
69+
- name: Push to registry
70+
uses: redhat-actions/push-to-registry@v2
71+
with:
72+
image: ${{ matrix.image }}
73+
tags: latest ${{ github.sha }}
74+
registry: ghcr.io/makeitworkcloud
75+
username: ${{ github.actor }}
76+
password: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pull.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Pull
3+
4+
on:
5+
workflow_run:
6+
workflows: ["Build"]
7+
types:
8+
- completed
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
import:
15+
runs-on: ubuntu-latest
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
strategy:
18+
matrix:
19+
image:
20+
- runner
21+
22+
steps:
23+
- name: Connect to Cloudflare WARP
24+
uses: Boostport/setup-cloudflare-warp@v1
25+
with:
26+
organization: makeitworkcloud
27+
auth_client_id: ${{ secrets.CLOUDFLARE_AUTH_CLIENT_ID }}
28+
auth_client_secret: ${{ secrets.CLOUDFLARE_AUTH_CLIENT_SECRET }}
29+
30+
- name: Install OpenShift CLI
31+
uses: redhat-actions/oc-installer@v1
32+
33+
- name: Login to OpenShift
34+
uses: redhat-actions/oc-login@v1
35+
with:
36+
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_URL }}
37+
openshift_username: ${{ secrets.OPENSHIFT_USERNAME }}
38+
openshift_password: ${{ secrets.OPENSHIFT_PASSWORD }}
39+
insecure_skip_tls_verify: true
40+
41+
- name: Import image to OpenShift
42+
run: oc import-image ${{ matrix.image }} -n public-registry

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: check-case-conflict
6+
- id: check-merge-conflict
7+
- id: check-symlinks
8+
- id: check-vcs-permalinks
9+
- id: destroyed-symlinks
10+
- id: detect-private-key
11+
- id: mixed-line-ending
12+
- id: trailing-whitespace
13+
- repo: https://github.com/hadolint/hadolint
14+
rev: v2.14.0
15+
hooks:
16+
- id: hadolint
17+
args: [--failure-threshold=error]

0 commit comments

Comments
 (0)