1
0
out-of-tree/.github/workflows/images.yml
2023-05-12 07:41:44 +00:00

39 lines
1.5 KiB
YAML

name: Generate images
on:
workflow_dispatch:
push:
paths:
- 'tools/**'
jobs:
images:
name: Images
runs-on: ubuntu-latest
steps:
- uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: create droplet
run: doctl compute droplet create --ssh-keys='b4:4c:66:7d:be:19:25:43:1c:e0:02:61:9f:49:12:94' --tag-name=github-actions ga-out-of-tree-$GITHUB_SHA --size s-1vcpu-1gb --image ubuntu-22-04-x64 --wait
- 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}')
sleep 1m
ssh -o StrictHostKeyChecking=accept-new root@$IP pkill apt-get
ssh -o StrictHostKeyChecking=accept-new root@$IP apt-get update
ssh -o StrictHostKeyChecking=accept-new root@$IP apt-get 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 "cd out-of-tree && git checkout $GITHUB_SHA"
ssh -o StrictHostKeyChecking=accept-new root@$IP ./out-of-tree/tools/qemu-debian-img/generate-images.sh
# - name: delete droplet
# if: always()
# run: doctl compute droplet delete -f ga-out-of-tree-$GITHUB_SHA