2023-05-12 06:58:17 +00:00
|
|
|
name: Generate images
|
2023-05-12 00:59:36 +00:00
|
|
|
|
|
|
|
on:
|
2023-05-12 01:32:46 +00:00
|
|
|
workflow_dispatch:
|
2023-05-12 01:04:17 +00:00
|
|
|
push:
|
|
|
|
paths:
|
|
|
|
- 'tools/**'
|
2023-05-12 00:59:36 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-05-12 06:58:17 +00:00
|
|
|
images:
|
|
|
|
name: Images
|
2023-05-12 00:59:36 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-05-12 06:58:17 +00:00
|
|
|
- uses: digitalocean/action-doctl@v2
|
2023-05-12 01:31:14 +00:00
|
|
|
with:
|
2023-05-12 06:58:17 +00:00
|
|
|
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
2023-05-12 01:31:14 +00:00
|
|
|
|
2023-05-12 06:58:17 +00:00
|
|
|
- uses: webfactory/ssh-agent@v0.8.0
|
2023-05-12 01:31:14 +00:00
|
|
|
with:
|
2023-05-12 06:58:17 +00:00
|
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
2023-05-12 01:31:14 +00:00
|
|
|
|
2023-05-12 06:58:17 +00:00
|
|
|
- name: create droplet
|
|
|
|
run: doctl compute droplet create --tag-name=github-actions ga-out-of-tree-$GITHUB_SHA --size s-1vcpu-1gb --image ubuntu-22-04-x64 --wait
|
2023-05-12 01:31:14 +00:00
|
|
|
|
2023-05-12 06:58:17 +00:00
|
|
|
- name: generate images
|
|
|
|
run: |
|
|
|
|
IP=$(doctl compute droplet list --tag-name=github-actions --format "Name,Public IPv4" | grep -v ID | grep ga-out-of-tree-$GITHUB_SHA | awk "{print $2}")
|
|
|
|
ssh -o StrictHostKeyChecking=accept-new root@$IP apt update
|
|
|
|
ssh -o StrictHostKeyChecking=accept-new root@$IP apt install -y git podman
|
|
|
|
ssh -o StrictHostKeyChecking=accept-new root@$IP git clone https://github.com/out-of-tree/out-of-tree
|
|
|
|
ssh -o StrictHostKeyChecking=accept-new root@$IP sh -c "cd out-of-tree && git checkout $GITHUB_SHA"
|
|
|
|
|
|
|
|
- name: delete droplet
|
|
|
|
if: always()
|
|
|
|
run: doctl compute droplet delete -f ga-out-of-tree-$GITHUB_SHA
|