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