GCHP 14.5.0 release #46
Workflow file for this run
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
# Release pipeline: | |
# | |
# This pipeline performs the deployment of a new gchp spack | |
# package upon the release of a new version | |
# | |
# This pipeline is triggered by tagged versions excluding | |
# pre-releases. | |
# | |
# Notes: | |
# - This workflow requires a personal access token for pushing to the | |
# pr-source-repo. The PAT needs repo + read:org permissions. The PAT | |
# needs to be added to the GCHP repo as an action secret | |
# called GH_PUSH_PAT. | |
name: spack_deployment | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
make_spack_pr: | |
runs-on: ubuntu-latest | |
container: continuumio/miniconda3 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get release tag | |
id: vars | |
run: | | |
GEOSCHEM_VERSION=${GITHUB_REF#refs/*/} | |
echo ::set-output name=release_tag::${GEOSCHEM_VERSION} | |
cd ${GITHUB_WORKSPACE} | |
git checkout $GEOSCHEM_VERSION | |
echo ::set-output name=release_sha::$(git rev-list -n 1 $GEOSCHEM_VERSION) | |
- name: Install dependencies | |
run: | | |
set -x | |
conda install -y -c conda-forge gh flake8 mypy isort curl | |
- name: Login with PAT | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "laestrada" | |
git config --global credential.helper store | |
echo "https://laestrada:${{ secrets.GH_PUSH_PAT }}@github.com/geoschem/spack.git" > ~/.git-credentials | |
echo ${{ secrets.GH_PUSH_PAT }} | gh auth login --with-token | |
- name: Update spack package and submit PR | |
env: | |
GEOSCHEM_VERSION: ${{ steps.vars.outputs.release_tag }} | |
VERSION_STRING: version('${{ steps.vars.outputs.release_tag }}', commit='${{ steps.vars.outputs.release_sha }}', submodules=True) | |
TAR_URL_PREFIX: https://github.com/geoschem/GCHP/archive | |
run: | | |
set -x | |
TEMP_DIR=$(mktemp -d) | |
SPACK_DIR=$TEMP_DIR/spack | |
# Checkout spack/spack:develop | |
git clone -c feature.manyFiles=true https://github.com/spack/spack.git $SPACK_DIR | |
cd $SPACK_DIR | |
git checkout develop | |
. share/spack/setup-env.sh | |
# Add geoschem/spack as a remote (PR will come from this repo) | |
git remote add pr-source-repo https://github.com/geoschem/spack.git | |
# Create a new branch for current release | |
git checkout -b gchp-${GEOSCHEM_VERSION} | |
# replace the tarball link to new version | |
sed -i "s|https://github.com/geoschem/GCHP/archive/.*.gz|${TAR_URL_PREFIX}/${GEOSCHEM_VERSION}.tar.gz|" var/spack/repos/builtin/packages/gchp/package.py | |
# add new line to version history | |
sed -i "0,/\( *\)version(.*/s##\1${VERSION_STRING}\n&#" var/spack/repos/builtin/packages/gchp/package.py | |
# test that style is up to snuff | |
spack style | |
# commit and create pull request from forked repo | |
git add . | |
git commit -m "gchp: added version ${GEOSCHEM_VERSION}" | |
git push pr-source-repo gchp-${GEOSCHEM_VERSION} | |
gh pr create --title "gchp: added version ${GEOSCHEM_VERSION}" --base develop --body "Pull request for ${GEOSCHEM_VERSION}" --repo spack/spack |