Skip to content

up: template action after content change #169

up: template action after content change

up: template action after content change #169

name: Update Archive
on:
push:
branches: [ master ]
tags: [ '*' ]
jobs:
skeleton:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: /usr/share/miniconda
key: conda-dist-v1
restore-keys: |
conda-dist-
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: false
python-version: 3.8
conda-channels: anaconda, conda-forge
- name: Install dependencies
run: |
conda config --set always_yes True
conda install git-annex datalad osfclient
- name: Pacify DataLad about git config
run: |
git config --global user.name "GitHub Action"
git config --global user.email "nipreps@gmail.com"
- name: Install all datasets
run: |
datalad install -r tpl-*/
- name: Generate skeleton
run: |
find . -type d -not -path "*/\.*" -exec mkdir -p /tmp/skel/{} \;
for i in $( find . -type f -not -path "*/\.*" ); do cp $i /tmp/skel/${i:2}; done
find . -type l -not -path "*/\.*" -exec touch /tmp/skel/{} \;
cd /tmp/skel
mkdir -p /tmp/resources
zip -r /tmp/resources/templateflow-skel.zip */
find . -type f -exec md5sum {} \; | sort -k 2 | md5sum > /tmp/resources/templateflow-skel.md5
- name: Save new skeleton
uses: actions/upload-artifact@v1
with:
name: templateflow-skel
path: /tmp/resources/templateflow-skel.zip
- name: Save new skeleton checksum
uses: actions/upload-artifact@v1
with:
name: templateflow-skel.md5
path: /tmp/resources/templateflow-skel.md5
- name: Upload skeleton to OSF
shell: bash
env:
OSF_TOKEN: ${{ secrets.OSF_TOKEN }}
OSF_PROJECT: ue5gx
run: |
cd /tmp/resources
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
TAG=${GITHUB_REF##*/}
fi
SHORTSHA=${GITHUB_SHA::8}
FILENAME=templateflow-${TAG:-latest}
echo "Uploading new skeleton: $FILENAME"
osf -p ${OSF_PROJECT} upload -f templateflow-skel.zip .skel/${FILENAME}.zip
osf -p ${OSF_PROJECT} upload -f templateflow-skel.md5 .skel/${FILENAME}.md5
- name: Checkout the Python client
uses: actions/checkout@v2
with:
repository: templateflow/python-client
path: python-client
ssh-key: "${{ secrets.NIPREPS_DEPLOY }}"
- name: Update skeleton in Python client
run: |
git config --global user.name "templateflow-bot"
git config --global user.email "nipreps@gmail.com"
cd /home/runner/work/templateflow/templateflow/python-client
cp /tmp/resources/templateflow-skel.{zip,md5} templateflow/conf/
git add templateflow/conf/templateflow-skel.{zip,md5}
git commit -m "auto: Update S3 skeleton file and checksum [skip ci]"
git push origin HEAD:master
- name: Checkout www.templateflow.org
uses: actions/checkout@v2
with:
repository: templateflow/www.templateflow.org
path: gh-pages
ssh-key: "${{ secrets.NIPREPS_DEPLOY }}"
- name: Update skeleton tree for website
run: |
git config --global user.name "templateflow-bot"
git config --global user.email "nipreps@gmail.com"
cd /home/runner/work/templateflow/templateflow/gh-pages
python gen_tree.py /tmp/resources/templateflow-skel.zip docs/assets/templateflow.json
if [[ "$( git diff --exit-code )" != "" ]]; then
git add docs/assets/templateflow.json
git commit -m "auto: update JSON tree"
git push origin HEAD:master
fi