From 682df63dc35bff6a9059b5c3b5f4363e13bbd658 Mon Sep 17 00:00:00 2001 From: JG2401 <76785435+JG2401@users.noreply.github.com> Date: Sat, 30 Aug 2025 11:25:58 +0200 Subject: [PATCH] Create initial.yml --- .github/workflows/initial.yml | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/initial.yml diff --git a/.github/workflows/initial.yml b/.github/workflows/initial.yml new file mode 100644 index 0000000..a4ad7fd --- /dev/null +++ b/.github/workflows/initial.yml @@ -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