67 lines
2.2 KiB
YAML
67 lines
2.2 KiB
YAML
name: 'deploy'
|
|
description: 'deploy'
|
|
|
|
inputs:
|
|
environment:
|
|
required: true
|
|
type: string
|
|
tag:
|
|
required: true
|
|
type: string
|
|
migrate:
|
|
type: bool
|
|
default: false
|
|
secrets:
|
|
required: false
|
|
type: string
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Argo Login
|
|
uses: clowdhaus/argo-cd-action/@main
|
|
with:
|
|
version: 3.1.3
|
|
command: login
|
|
options: ${{ vars.ARGO_HOST }} --username ${{ vars.ARGO_USER }} --password ${{ fromJSON(inputs.secrets).ARGO_PASSWORD }}
|
|
- name: Change tag name
|
|
uses: clowdhaus/argo-cd-action/@main
|
|
with:
|
|
version: 3.1.3
|
|
command: app set ${{ inputs.environment }} --parameter images.${{github.event.repository.name}}=${{ inputs.tag }}
|
|
- name: Sync changes
|
|
if: ${{ inputs.migrate == 'true' }}
|
|
uses: clowdhaus/argo-cd-action/@main
|
|
with:
|
|
version: 3.1.3
|
|
command: app sync ${{ inputs.environment }} --resource apps:Deployment:${{github.event.repository.name}}
|
|
- name: Migrate
|
|
if: ${{ inputs.migrate == 'true' }}
|
|
uses: clowdhaus/argo-cd-action/@main
|
|
with:
|
|
version: 3.1.3
|
|
command: app actions run ${{ inputs.environment }} migrate --kind Deployment --resource-name ${{github.event.repository.name}}
|
|
- name: Sync related deployments
|
|
shell: bash
|
|
run: |
|
|
for name in $(argocd app resources ${{ inputs.environment }} | grep Deploy | grep ${{ github.event.repository.name }} | awk '{print($4)}'); do
|
|
echo "Syncing $name"
|
|
argocd app sync ${{ inputs.environment }} --resource apps:Deployment:$name;
|
|
done
|
|
|
|
- name: Refresh secret
|
|
uses: clowdhaus/argo-cd-action/@main
|
|
with:
|
|
version: 3.1.3
|
|
command: app actions run ${{ inputs.environment }} refresh --kind ExternalSecret --resource-name vault-${{github.event.repository.name}}
|
|
- name: Restart service
|
|
uses: clowdhaus/argo-cd-action/@main
|
|
with:
|
|
version: 3.1.3
|
|
command: app actions run ${{ inputs.environment }} restart --kind Deployment --resource-name ${{github.event.repository.name}}
|
|
|
|
- name: Run Tests
|
|
uses: clowdhaus/argo-cd-action/@main
|
|
with:
|
|
version: 3.1.3
|
|
command: app actions run ${{ inputs.environment }} run-tests --kind Deployment --resource-name ${{github.event.repository.name}} |