Useful for deploying to every droplet with a certain tag.
steps:
- name: 📫 Fetch deploy IPs for processors
id: deploy-to-processor
uses: squarecat/get-droplet-ips-action@1.0.5
with:
digital-ocean-key: ${{ secrets.DO_API_KEY }} # DigitalOcean API key
tag: processor # tag to search for
network-type: public # fetch "public" or "private" IPsThe IPs will be output as a JSON array in steps.<step_name>.outputs.server_ips. eg the above example will output to steps.deploy-to-processor.outputs.server_ips
It's easy to pass the IPs to the next job as a matrix, creating a seperate job for each IP.
name: Deploy things
jobs:
build:
name: 👷♂️ Build
runs-on: ubuntu-latest
outputs:
server_ips: ${{ steps.deploy-to-processor.outputs.server_ips || 'no-server-ip-found' }}
steps:
- name: 📫 Fetch deploy IPs for processors
id: deploy-to-processor
if: ${{ github.event.inputs.app == 'processor' }}
uses: squarecat/get-droplet-ips-action@1.0.5
with:
digital-ocean-key: ${{ secrets.DO_API_KEY }}
tag: processor
deploy:
name: 🚀 Deploy
runs-on: ubuntu-latest
needs: [build]
strategy:
matrix:
server_ip: ${{fromJson(needs.build.outputs.server_ips)}}
steps:
- name: Your deploy steps...
...Results in the following jobs:
