Browse Source

Add cleanup job at end of workflow

- Runs the doctl to remove the image ID
pull/22/head
Micaiah Martin 4 years ago
parent
commit
7fee6ca743
  1. 19
      .github/workflows/release-digital-ocean.yml
  2. 7
      DigitalOceanMarketplace/marketplace-image.json

19
.github/workflows/release-digital-ocean.yml

@ -44,3 +44,22 @@ jobs:
DIGITALOCEAN_IMG_VERSION: ${{ steps.set-version.outputs.version }} DIGITALOCEAN_IMG_VERSION: ${{ steps.set-version.outputs.version }}
working-directory: ./DigitalOceanMarketplace working-directory: ./DigitalOceanMarketplace
run: packer build marketplace-image.json run: packer build marketplace-image.json
- name: Digital Ocean Image Cleanup
env:
DIGITALOCEAN_TOKEN: ${{ steps.retrieve-secrets.outputs.digital-ocean-api-key }}
working-directory: ./DigitalOceanMarketplace
if: |
github.ref != 'refs/heads/master' ||
github.ref != 'refs/head/hotfix' ||
github.ref != 'refs/heads/rc'
run: |
brew install doctl
# Authenticate to Digital Ocean.
doctl auth init -t $DIGITALOCEAN_TOKEN
# Get the ID from the snapshot build.
DO_ARTIFACT=$(jq -r '.builds[-1].artifact_id' manifest.json | cut -d ":" -f2)
# Force remove the snapshot
doctl compute image delete $DO_ARTIFACT -f

7
DigitalOceanMarketplace/marketplace-image.json

@ -82,5 +82,12 @@
"scripts/99-img-check.sh" "scripts/99-img-check.sh"
] ]
} }
],
"post-processors": [
{
"type": "manifest",
"output": "manifest.json",
"strip_path": true
}
] ]
} }

Loading…
Cancel
Save