Skip to content

Commit

Permalink
Added pr-closed.yml: Responsible for Prerelease cleanup after PR closed
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeGat committed Mar 15, 2024
1 parent 6f96e10 commit 6318f68
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/pr-closed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR Closed Cleanup
# Remove prereleases that were part of a closed PR, so we save space
# on our deployment targets. If needed, one can still get the
# spack.yaml as part of the closed PR and revive it themselves.
on:
pull_request:
types:
- closed
branches:
- main
- backport/*.*
paths:
- config/**
- spack.yaml
env:
SPACK_YAML_MODEL_YQ: .spack.specs[0]
jobs:
get-prerelease-tag-pattern:
name: Get Prerelease Tag Pattern
# Get the tag name from the `spack.yaml` that was in the PR that was closed
# which is of the form `access-om2@git.<version>`.
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.name }}
steps:
- uses: actions/checkout@v4

- name: Get Tag
id: tag
# Get the tag name from the access-om2 spec in the `spack.yaml`.
run: |
access_om2_package=$(yq e '${{ env.SPACK_YAML_MODEL_YQ }}' spack.yaml)
echo "name=${access_om2_package/*@git./}" >> $GITHUB_OUTPUT
undeploy-prereleases:
name: Undeploy Prereleases
needs:
- get-prerelease-tag-pattern
uses: access-nri/build-cd/.github/workflows/undeploy-1-setup.yml@main
with:
version-pattern: ${{ needs.get-prerelease-tag-pattern.outputs.tag }}-*
secrets: inherit

0 comments on commit 6318f68

Please sign in to comment.