Nightly Build for Development Purposes Only #750
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Nightly Build for Development Purposes Only | |
on: | |
schedule: | |
- cron: '45 13 * * *' | |
workflow_dispatch: | |
jobs: | |
configure_unity_job: | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
metadata: "" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Write METADATA to file | |
uses: jsdaniell/create-json@v1.2.2 | |
with: | |
name: nightly_metadata.json | |
json: '{ "metadataVersion":"unity-cs-0.1", "exectarget": "github", | |
"deploymentName":"some name for the deployment of services", | |
"services":[ { "name":"unity-sps-prototype", | |
"source":"unity-sds/unity-sps-prototype", | |
"version":"xxx","branch":"d967f6bac0f985c6cb0d28888804c4f78959be35" } ], "extensions":{ "kubernetes":{ | |
"clustername":"testclustertomthurs", "owner":"tom", | |
"projectname":"testproject", "nodegroups":{ "group1":{ | |
"instancetype":"m5.xlarge", "nodecount":"1" } } }, "apigateway":{"apis":[{"name":"ucs-nightly"}]}}}' | |
- name: Generate Nightly ID | |
uses: TGPSKI/name-generator-node-action@v2 | |
id: generator | |
with: | |
separator: _ | |
length: "2" | |
style: lowerCase | |
- name: Update METADATA with nightly values | |
uses: jossef/action-set-json-field@v2.1 | |
with: | |
file: nightly_metadata.json | |
field: extensions.kubernetes.owner | |
value: uc-s-nightly | |
- name: Update METADATA with nightly values | |
uses: jossef/action-set-json-field@v2.1 | |
with: | |
file: nightly_metadata.json | |
field: extensions.kubernetes.clustername | |
value: ucsnightlycluster | |
- name: Update METADATA with nightly values | |
uses: jossef/action-set-json-field@v2.1 | |
with: | |
file: nightly_metadata.json | |
field: deploymentName | |
value: Unity CS Nightly Build | |
- name: Update METADATA with nightly values | |
uses: jossef/action-set-json-field@v2.1 | |
with: | |
file: nightly_metadata.json | |
field: services.0.name | |
value: unity-sps-prototype-nightly | |
- name: Read Nightly Metadata | |
id: nightly_build_metadata | |
run: > | |
echo "::set-env name=NEW_NEW_METADATA::$( cat nightly_metadata.json | jq --compact-output )" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Output new inputs | |
run: echo '${{ steps.nightly_build_metadata.outputs.contents }}' | |
- name: Output new new inputs | |
run: echo '${{ env.NEW_NEW_METADATA }}' | |
- name: Unity custom action step | |
uses: unity-sds/unity-cs-action@2c9d15194f6922313258dc6ea3d2689c4dfc3f3c | |
id: runinstall | |
env: | |
NIGHTLY_METADATA: ${ steps.nightly_build_metadata.outputs.contents } | |
with: | |
token: ${{ secrets.TOKEN }} | |
ucsmetadata: ${{ env.NEW_NEW_METADATA }} | |
- name: Print the resulting meta | |
run: echo "The time was ${{ steps.runinstall.outputs.eksmeta }}" | |
- name: Write METADATA to file | |
if: always() | |
uses: jsdaniell/create-json@v1.2.2 | |
with: | |
name: nightly_metadata.json | |
json: ${{ env.NEW_NEW_METADATA }} | |
- name: Update METADATA with nightly values | |
uses: jossef/action-set-json-field@v2.1 | |
if: always() | |
with: | |
file: nightly_metadata.json | |
field: deploymentType | |
value: teardown | |
- name: Read Nightly Metadata | |
if: always() | |
id: nightly_build_metadata_teardown | |
run: > | |
echo "::set-env name=NEW_NEW_METADATA::$( cat nightly_metadata.json | jq --compact-output )" | |
- name: Teardown EKS | |
if: always() | |
uses: unity-sds/unity-cs-action@2c9d15194f6922313258dc6ea3d2689c4dfc3f3c | |
id: runteardown | |
env: | |
NIGHTLY_METADATA: ${ steps.nightly_build_metadata_teardown.outputs.contents } | |
with: | |
token: ${{ secrets.TOKEN }} | |
ucsmetadata: ${{ env.NEW_NEW_METADATA }} |