Launch Server #83
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Launch Server | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
inputs: | |
size: | |
description: droplet size | |
type: choice | |
default: s-1vcpu-1gb-amd | |
options: | |
- s-1vcpu-1gb-amd | |
- s-1vcpu-2gb-amd | |
- s-2vcpu-2gb-amd | |
- s-2vcpu-4gb-amd | |
- s-2vcpu-8gb-amd | |
- s-4vcpu-8gb | |
defaults: | |
run: | |
working-directory: ./terraform | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: hashicorp/setup-terraform@v3 | |
with: | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Terraform Init | |
run: terraform init | |
- name: Terraform Validate | |
run: terraform validate | |
- name: Terraform Apply | |
run: | | |
terraform apply -auto-approve | |
echo "DROPLET_IPV4_ADDRESS=$(terraform output -raw droplet_ipv4_address)" >> $GITHUB_ENV | |
env: | |
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} | |
TF_VAR_droplet_size: ${{ inputs.size }} | |
- name: ${{ env.DROPLET_IPV4_ADDRESS }} | |
run: echo $DROPLET_IPV4_ADDRESS |