theshire/.forgejo/workflows/schemas.yaml

80 lines
2.3 KiB
YAML
Raw Normal View History

---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Schemas"
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *" # Every day at midnight
push:
branches: ["main"]
paths: [".forgejo/workflows/schemas.yaml"]
jobs:
publish:
name: Schemas
2024-05-28 20:58:20 -05:00
runs-on: ["docker-x86_64"]
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Workflow Tools
shell: bash
2024-05-28 21:12:46 -05:00
run: |
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
2024-05-28 21:15:05 -05:00
mv kubectl /usr/local/bin/
2024-05-28 21:12:46 -05:00
curl -LO "https://dl.min.io/client/mc/release/linux-amd64/mc"
chmod +x mc
2024-05-28 21:15:05 -05:00
mv mc /usr/local/bin/
- name: Setup Python
2024-05-28 21:24:47 -05:00
run: |
2024-05-28 22:54:26 -05:00
apt-get update
2024-05-28 21:30:32 -05:00
apt-get install -y python3 python3-pip
pip3 install --upgrade pip
- name: Write kubeconfig
id: kubeconfig
uses: https://github.com/timheuer/base64-to-file@v1
with:
encodedString: "${{ secrets.KUBECONFIG }}"
fileName: kubeconfig
fileDir: $GITHUB_WORKSPACE
- name: Write mc
id: mcconfig
uses: https://github.com/timheuer/base64-to-file@v1
with:
encodedString: "${{ secrets.MCCONFIG }}"
fileName: config.json
fileDir: $GITHUB_WORKSPACE
2024-05-28 22:59:20 -05:00
- name: test kubectl
2024-05-29 06:59:33 -05:00
env:
KUBECONFIG: "${{ steps.kubeconfig.outputs.filePath }}"
2024-05-28 22:59:20 -05:00
run: |
kubectl get nodes
- name: Download and run crd-extractor
env:
KUBECONFIG: "${{ steps.kubeconfig.outputs.filePath }}"
shell: bash
run: |
curl -fsSL -o $GITHUB_WORKSPACE/crd-extractor.sh \
https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/Utilities/crd-extractor.sh
chmod +x $GITHUB_WORKSPACE/crd-extractor.sh
bash $GITHUB_WORKSPACE/crd-extractor.sh
- name: Deploy to Cloudflare R2
2024-05-29 06:58:22 -05:00
env:
MC_CONFIG_DIR: $GITHUB_WORKSPACE
shell: bash
run: |
mc cp --recursive $HOME/.datree/crdSchemas/ r2-ks/kubernetes-schemas