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

add environment to be able to access variables in github deploy #8

add environment to be able to access variables in github deploy

add environment to be able to access variables in github deploy #8

Workflow file for this run

name: Pack and Deploy
on:
push:
branches:
- main
- staging
# to be deleted after testing
- charm-jaas
workflow_dispatch:
inputs:
environment:
description: 'Environment (Production or Staging)'
required: true
type: choice
options:
- Production
- Staging
jobs:
setup:
name: Setup
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
deploy:
needs: setup
name: Deploy
uses: canonical/webteam-devops/.github/workflows/deploy.yaml@refactor-deploy-github-action
environment: ${{ needs.setup.outputs.environment }}

Check failure on line 47 in .github/workflows/deploy.yaml

View workflow run for this annotation

GitHub Actions / Pack and Deploy

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yaml (Line: 47, Col: 5): Unexpected value 'environment'
with:
charm_name: ${{ vars.CHARM_NAME }}
channel: ${{ vars.CHANNEL }}
juju_controller_name: ${{ vars.JUJU_CONTROLLER_NAME }}
juju_model_name: ${{ vars.JUJU_MODEL_NAME }}
environment: ${{ needs.setup.outputs.environment }}
environmentUrl: ${{ vars.ENVIRONMENT_URL }}
secrets:
VAULT_APPROLE_ROLE_ID: ${{ secrets.VAULT_APPROLE_ROLE_ID }}
VAULT_APPROLE_SECRET_ID: ${{ secrets.VAULT_APPROLE_SECRET_ID }}
CHARMHUB_TOKEN: ${{ secrets.CHARMHUB_TOKEN }}