mirror of
https://github.com/JG2401/HetznerKubelab.git
synced 2026-08-28 20:20:17 +00:00
Create initial.yml
This commit is contained in:
51
.github/workflows/initial.yml
vendored
Normal file
51
.github/workflows/initial.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Initial
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
initial:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y curl unzip git
|
||||
|
||||
- name: Install Packer, Terraform, kubectl, hcloud
|
||||
run: |
|
||||
# Install Packer
|
||||
wget -O - https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y packer terraform
|
||||
# Install hcloud CLI
|
||||
curl -fsSL https://github.com/hetznercloud/cli/releases/latest/download/hcloud-linux-amd64.tar.gz | tar -xz
|
||||
sudo mv hcloud /usr/local/bin/
|
||||
|
||||
- name: Run Hetzner Kube script (non-interactive)
|
||||
env:
|
||||
HCLOUD_TOKEN: ${{ secrets.HCLOUD_TOKEN }}
|
||||
folder_name: config
|
||||
folder_path: .
|
||||
create_snapshots: yes
|
||||
run: |
|
||||
tmp_script=$(mktemp)
|
||||
curl -sSL -o "${tmp_script}" https://raw.githubusercontent.com/kube-hetzner/terraform-hcloud-kube-hetzner/master/scripts/create.sh
|
||||
chmod +x "${tmp_script}"
|
||||
bash "${tmp_script}"
|
||||
rm "${tmp_script}"
|
||||
|
||||
- name: Commit and push kube.tf + snapshot file
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add config/kube.tf
|
||||
git add config/hcloud-microos-snapshots.pkr.hcl
|
||||
git commit -m "Add generated kube.tf and snapshot file from workflow" || echo "No changes to commit"
|
||||
git push
|
||||
Reference in New Issue
Block a user