|
| 1 | +name: Undeployment Setup |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + version: |
| 6 | + type: string |
| 7 | + required: true |
| 8 | + description: The version of the model being removed |
| 9 | +jobs: |
| 10 | + get-spack-env: |
| 11 | + name: Get Spack Environment |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + model: ${{ steps.get-model.outputs.model }} |
| 15 | + env-name: ${{ steps.get-env-name.outputs.env-name }} |
| 16 | + steps: |
| 17 | + - name: Get Model |
| 18 | + id: get-model |
| 19 | + # for the cases where the repo name is in uppercase but the package name is lowercase (eg. access-nri/MOM5) |
| 20 | + run: echo "model=$(echo ${{ github.event.repository.name }} | tr [:upper:] [:lower:])" >> $GITHUB_OUTPUT |
| 21 | + - name: Set Spack Env Name String |
| 22 | + id: get-env-name |
| 23 | + # replace occurences of '.' with '_' in environment name as spack doesn't support '.'. Ex: 'access-om2-v1.0.0' -> 'access-om2-v1_0_0'. |
| 24 | + run: echo "env-name=$(echo '${{ steps.get-model.outputs.model }}-${{ inputs.version }}' | tr '.' '_')" >> $GITHUB_OUTPUT |
| 25 | + |
| 26 | + get-prerelease-deployment-env: |
| 27 | + name: Get Prerelease Deployment Environment |
| 28 | + runs-on: ubuntu-latest |
| 29 | + outputs: |
| 30 | + deployment-environments: ${{ steps.get-deployment-environment.outputs.deployment-environments }} |
| 31 | + steps: |
| 32 | + - name: Checkout Config |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + repository: access-nri/build-cd |
| 36 | + |
| 37 | + - name: Get Environments |
| 38 | + id: get-deployment-environment |
| 39 | + run: echo "deployment-environments=$(jq --compact-output '.prerelease-environments' ./config/deployment-environment.json)" >> $GITHUB_OUTPUT |
| 40 | + |
| 41 | + |
| 42 | + deployment: |
| 43 | + name: Deployment |
| 44 | + needs: |
| 45 | + - get-spack-env |
| 46 | + - get-prerelease-deployment-env |
| 47 | + strategy: |
| 48 | + fail-fast: false |
| 49 | + matrix: |
| 50 | + deployment-environment: ${{ fromJson(needs.get-prerelease-deployment-env.outputs.deployment-environments) }} |
| 51 | + uses: access-nri/build-cd/.github/workflows/undeploy-2-start.yml@main |
| 52 | + with: |
| 53 | + deployment-environment: ${{ matrix.deployment-environment }} |
| 54 | + env-name: ${{ needs.get-spack-env.outputs.env-name }} |
| 55 | + secrets: inherit |
0 commit comments