-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
52 lines (48 loc) · 1.73 KB
/
action.yml
File metadata and controls
52 lines (48 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Get Spack Manifest Information
description: Action that returns information about a Spack manifest file
author: Tommy Gatti
inputs:
spack-manifest-path:
required: false
default: spack.yaml
description: The path to the spack manifest file
outputs:
deployment-name:
description: |
The name of the deployment as specified in the reserved definition _name, in the spack manifest file.
value: ${{ steps.defs.outputs.name }}
deployment-version:
description: |
The version of the deployment as specified in the reserved definition _version, in the spack manifest file.
value: ${{ steps.defs.outputs.version }}
runs:
using: composite
steps:
- name: Clone build-cd script location
uses: actions/checkout@v4
with:
repository: access-nri/build-cd
path: ${{ github.workspace }}/getter-script
- name: Get Current Directory
id: script
# We need to store the current working directory so we can re-construct the inputs.spack-manifest-path, as we run
# the script from the build-cd directory
shell: bash
run: |
pwd=$(pwd)
echo "Action PWD: $pwd"
echo "pwd=$pwd" >> $GITHUB_OUTPUT
- name: Get reserved definitions
id: defs
env:
PYTHONPATH: ${{ github.workspace }}/getter-script
shell: python
run: |
from scripts.spack_manifest.getter import ReservedDefinitions
import os
defs = ReservedDefinitions.from_file("${{ steps.script.outputs.pwd }}/${{ inputs.spack-manifest-path }}")
name = defs.get("name")
version = defs.get("version")
with open(os.environ['GITHUB_OUTPUT'], 'a') as o:
o.write(f"name={name}\n")
o.write(f"version={version}\n")