Skip to content

Commit

Permalink
ci.yml: Added branch rules, added prerelease deployment job
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeGat committed Feb 1, 2024
1 parent feac9d3 commit 04b3b12
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: CI
on:
pull_request:
branches:
# Branches that modify spack.yaml must be of the form: pre-*.*.* (ex: pre-2024.01.1)
# in order for the PR to access the '* Prerelease' GitHub Environments.
- 'pre-*.*.*'
paths:
- 'config/*.json'
- 'spack.yaml'
Expand Down Expand Up @@ -78,20 +82,48 @@ jobs:
if: ${{ needs.changed.outputs.versions-json-changed == 'true' }}
steps:
- uses: actions/checkout@v4

- name: Setup
id: versions
run: |
echo "packages=$(jq --compact-output --raw-output '."spack-packages"' ./config/versions.json)" >> $GITHUB_OUTPUT
echo "config=$(jq --compact-output --raw-output '."spack-config"' ./config/versions.json)" >> $GITHUB_OUTPUT
- name: Spack Packages
uses: actions/checkout@v4
with:
repository: access-nri/spack-packages
ref: ${{ steps.versions.outputs.packages }}
path: packages

- name: Spack Config
uses: actions/checkout@v4
with:
repository: access-nri/spack-config
ref: ${{ steps.versions.outputs.config }}
path: config

prerelease-deploy-version:
name: Get Prerelease Number
runs-on: ubuntu-latest
outputs:
number: ${{ steps.history.outputs.commits }}
steps:
- uses: actions/checkout@v4

- name: Get Number of Commits on ${{ github.head_ref }}
id: history
run: echo "commits=$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT

prerelease-deploy:
name: Deploy to Prerelease
needs:
- prerelease-deploy-version
- spack-yaml-checks
- validate
- check-versions-exist
uses: access-nri/build-cd/.github/workflows/deploy-1-setup.yml@main
with:
type: prerelease
version: ${{ github.head_ref }}-pre${{ needs.prerelease-deploy-version.outputs.number }}
secrets: inherit

0 comments on commit 04b3b12

Please sign in to comment.