Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Merge pull request #792 from canonical/contact-form-fix #30

Merge pull request #792 from canonical/contact-form-fix

Merge pull request #792 from canonical/contact-form-fix #30

Workflow file for this run

name: Pack and Deploy
on:
push:
branches:
- main
- staging
workflow_dispatch:
inputs:
environment:
description: 'Environment (Production or Staging)'
required: true
type: choice
options:
- Production
- Staging
jobs:
find-env:
name: Find environment
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.set_env.outputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine environment
id: set_env
run: |
if [[ -n "${{ github.event.inputs.environment }}" ]]; then
echo "environment=${{ github.event.inputs.environment }}" >> "$GITHUB_OUTPUT"
elif [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
echo "environment=Production" >> "$GITHUB_OUTPUT"
else
echo "environment=Staging" >> "$GITHUB_OUTPUT"
fi
setup:
name: Setup
runs-on: ubuntu-latest
needs: find-env
environment: ${{ needs.find-env.outputs.environment }}
outputs:
environment: ${{ steps.set.outputs.environment }}
environment_url: ${{ steps.set.outputs.environment_url }}
charm_name: ${{ steps.set.outputs.charm_name }}
channel: ${{ steps.set.outputs.channel }}
juju_controller_name: ${{ steps.set.outputs.juju_controller_name }}
juju_model_name: ${{ steps.set.outputs.juju_model_name }}
steps:
- id: set
run: |
echo "environment=${{ needs.find-env.outputs.environment }}" >> "$GITHUB_OUTPUT"
echo "environment_url=${{ vars.ENVIRONMENT_URL }}" >> "$GITHUB_OUTPUT"
echo "charm_name=${{ vars.CHARM_NAME }}" >> "$GITHUB_OUTPUT"
echo "channel=${{ vars.CHANNEL }}" >> "$GITHUB_OUTPUT"
echo "juju_controller_name=${{ vars.JUJU_CONTROLLER_NAME }}" >> "$GITHUB_OUTPUT"
echo "juju_model_name=${{ vars.JUJU_MODEL_NAME }}" >> "$GITHUB_OUTPUT"
deploy:
needs: setup
name: Deploy
uses: canonical/webteam-devops/.github/workflows/deploy.yaml@v1
with:
environment: ${{ needs.setup.outputs.environment }}
environment_url: ${{ needs.setup.outputs.environment_url }}
charm_name: ${{ needs.setup.outputs.charm_name }}
channel: ${{ needs.setup.outputs.channel }}
juju_controller_name: ${{ needs.setup.outputs.juju_controller_name }}
juju_model_name: ${{ needs.setup.outputs.juju_model_name }}
secrets:
VAULT_APPROLE_ROLE_ID: ${{ secrets.VAULT_APPROLE_ROLE_ID }}
VAULT_APPROLE_SECRET_ID: ${{ secrets.VAULT_APPROLE_SECRET_ID }}
CHARMHUB_TOKEN: ${{ secrets.CHARMHUB_TOKEN }}