Version 2024.10.0 #189
Workflow file for this run
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: Release Digital Ocean 1-Click | |
on: | |
release: | |
types: [published] | |
push: | |
paths: | |
- "DigitalOceanMarketplace/**" | |
workflow_dispatch: | |
jobs: | |
build-image: | |
name: Build Image | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Login to Azure - CI Subscription | |
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 | |
with: | |
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | |
- name: Retrieve secrets | |
id: retrieve-secrets | |
uses: bitwarden/gh-actions/get-keyvault-secrets@main | |
with: | |
keyvault: "bitwarden-ci" | |
secrets: "digital-ocean-api-key" | |
- name: Set version from version.json | |
id: set-version | |
run: | | |
VERSION=$(grep '^ *"coreVersion":' version.json \ | |
| awk -F\: '{ print $2 }' \ | |
| sed -e 's/,$//' -e 's/^"//' -e 's/"$//') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Set up Hashicorp Packer | |
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232 # v3.1.0 | |
- name: Build Digital Ocean Image | |
env: | |
DIGITALOCEAN_TOKEN: ${{ steps.retrieve-secrets.outputs.digital-ocean-api-key }} | |
DIGITALOCEAN_IMG_VERSION: ${{ steps.set-version.outputs.version }} | |
working-directory: ./DigitalOceanMarketplace | |
run: | | |
packer version | |
packer init -upgrade marketplace-image.pkr.hcl | |
packer build marketplace-image.pkr.hcl | |
- name: Install doctl | |
if: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }} | |
uses: digitalocean/action-doctl@135ac0aa0eed4437d547c6f12c364d3006b42824 # v2.5.1 | |
with: | |
token: ${{ steps.retrieve-secrets.outputs.digital-ocean-api-key }} | |
- name: Digital Ocean Image Cleanup | |
working-directory: ./DigitalOceanMarketplace | |
if: ${{ github.event_name != 'release' && github.event_name != 'workflow_dispatch' }} | |
run: | | |
# 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 |