6161 runs-on : ubuntu-latest
6262 environment : ${{ inputs.deployment-target }} ${{ inputs.deployment-type }}
6363 outputs :
64- packages-version : ${{ steps.versions.outputs.packages }}
65- config-version : ${{ steps.versions.outputs.config }}
6664 spack-location : ${{ steps.location.outputs.spack }}
6765 modules-location : ${{ steps.location.outputs.modules }}
6866 root-spec-pkg-hash : ${{ steps.metadata.outputs.root-spec-pkg-hash }}
8381 id : versions
8482 run : |
8583 echo "spack=$(jq --compact-output --raw-output '.spack' ./config/versions.json)" >> $GITHUB_OUTPUT
86- echo "packages=$(jq --compact-output --raw-output '."spack-packages"' ./config/versions.json)" >> $GITHUB_OUTPUT
84+ echo "packages=$(jq --compact-output --raw-output '."access- spack-packages"' ./config/versions.json)" >> $GITHUB_OUTPUT
8785
8886 - name : Get ${{ inputs.deployment-target }} ${{ inputs.deployment-type }} Remote Paths
8987 id : path
@@ -177,34 +175,12 @@ jobs:
177175 done
178176 EOT
179177
180- - name : Update spack-packages repository
181- run : |
182- ssh ${{ secrets.USER}}@${{ secrets.HOST }} -i ${{ steps.ssh.outputs.private-key-path }} /bin/bash <<'EOT'
183- # Check that a suitable spack-packages location exists
184- if [ ! -d '${{ steps.path.outputs.spack-packages-root }}' ]; then
185- echo '::error::spack-packages does not exist in ${{ steps.path.outputs.root }} for ${{ inputs.deployment-target }} ${{ inputs.deployment-type}}'
186- exit 1
187- fi
188-
189- # In the case of a Prerelease, we need to create a new instance of spack-packages per commit, so there is no concurrent access problems.
190- if [ ! -d '${{ steps.path.outputs.spack-packages }}' ]; then
191- echo 'Creating spack-packages instance for ${{ inputs.env-name }} under ${{ steps.path.outputs.spack-packages }}'
192- mkdir -p ${{ steps.path.outputs.spack-packages }}
193- git clone https://github.com/ACCESS-NRI/spack-packages.git '${{ steps.path.outputs.spack-packages }}'
194- fi
195-
196- cd ${{ steps.path.outputs.spack-packages }} || exit 1
197-
198- git fetch --all --tags
199-
200- if git ls-remote --exit-code --heads origin ${{ steps.versions.outputs.packages }}; then # If the ref is a branch
201- echo "Checking out the branch at the latest commit"
202- git checkout -B ${{ steps.versions.outputs.packages }} origin/${{ steps.versions.outputs.packages }}
203- else # checkout the tag/commit
204- echo "Checking out the tag/commit"
205- git checkout ${{ steps.versions.outputs.packages }}
206- fi
207- EOT
178+ - name : Get SHA for access-spack-packages repository
179+ id : packages-ref
180+ uses : access-nri/actions/.github/actions/get-git-ref-info@main
181+ with :
182+ repository : ACCESS-NRI/access-spack-packages
183+ ref : ${{ steps.versions.outputs.packages }}
208184
209185 - name : Deploy to ${{ inputs.deployment-target }} ${{ inputs.deployment-type }}
210186 id : deploy
@@ -224,9 +200,13 @@ jobs:
224200 # Enable spack
225201 . ${{ steps.path.outputs.spack-config }}/spack-enable.bash
226202
227- # Create environment and build model
228- spack env create ${{ inputs.env-name }} ${{ vars.SPACK_YAML_LOCATION }}/${{ inputs.expected-root-spec-name }}-${{ github.run_id }}.spack.yaml
229- spack env activate ${{ inputs.env-name }}
203+ # Create and activate environment
204+ spack env activate ${{ inputs.env-name }} --create --envfile ${{ vars.SPACK_YAML_LOCATION }}/${{ inputs.expected-root-spec-name }}-${{ github.run_id }}.spack.yaml
205+
206+ # Update access-spack-packages repository before installation
207+ spack repo update access_spack_packages --commit ${{ steps.packages-ref.outputs.sha }}
208+
209+ # Finally, install the spack manifest
230210 spack --debug install --fail-fast --fresh ${{ vars.SPACK_INSTALL_ADDITIONAL_ARGS }} || exit $?
231211 spack module tcl refresh -y
232212 EOT
0 commit comments