From ff7c1d8326f7f1a70667ef823e2c5b82a9c19fa5 Mon Sep 17 00:00:00 2001 From: zmzlois Date: Sun, 17 Mar 2024 05:23:07 +0000 Subject: [PATCH] setup github action --- .github/workflows/setup.yml | 88 +++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/.github/workflows/setup.yml b/.github/workflows/setup.yml index e69de29..188715a 100644 --- a/.github/workflows/setup.yml +++ b/.github/workflows/setup.yml @@ -0,0 +1,88 @@ +name: Initial Setup + +on: + release: + types: [published] + push: + branches: + - main + workflow_dispatch: + +env: + LONDON_HOST: ${{ secrets.LONDON_HOST }} + FRANKFURT_HOST: ${{ secrets.FRANKFURT_HOST }} + SEATTLE_HOST: ${{ secrets.SEATTLE_HOST }} + SECRET_KEY: ${{ secrets.SECRET_KEY }} + USERNAME: ${{ secrets.USERNAME }} + +jobs: + prepare-all-host: + name: Prepare London Host + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Checkout all directory + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ env.LONDON_HOST }}, ${{ env.FRANKFURT_HOST }}, ${{ env.SEATTLE_HOST }} + username: ${{ env.USERNAME }} + key: ${{ env.SECRET_KEY }} + port: 22 + script: | + chmod +x ./shared/preparation.sh + ./shared/preparation.sh + timeout: 3000s + + install-k3s-london: + needs: prepare-all-host + name: Install K3s on London Host + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install K3s on London Host + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ env.LONDON_HOST }} + username: ${{ env.USERNAME }} + key: ${{ env.SECRET_KEY }} + port: 22 + script: | + chmod +x ./hosts/master-london.sh + ./hosts/master-london.sh + timeout: 3000s + + install-k3s-frankfurt: + needs: install-k3s-london + name: Install K3s on Frankfurt Host + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install K3s on Frankfurt Host + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ env.FRANKFURT_HOST }} + username: ${{ env.USERNAME }} + key: ${{ env.SECRET_KEY }} + port: 22 + script: | + chmod +x ./hosts/worker-frankfurt.sh + ./hosts/worker-frankfurt.sh + timeout: 3000s + + install-k3s-seattle: + needs: install-k3s-london + name: Install K3s on Seattle Host + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install K3s on Seattle Host + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ env.SEATTLE_HOST }} + username: ${{ env.USERNAME }} + key: ${{ env.SECRET_KEY }} + port: 22 + script: | + chmod +x ./hosts/worker-seattle.sh + ./hosts/worker-seattle.sh + timeout: 3000s