Connect to Bioconductor Repository #38
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
on: | |
workflow_dispatch: | |
inputs: | |
action: | |
description: "Type 'push' to push, 'pull' to pull latest changes from Bioconductor's remote. Otherwise, only diff with remote is shown." | |
required: true | |
default: "show diff only" | |
source_branch: | |
description: "The source branch from GitHub" | |
required: true | |
default: "devel" | |
bioc_branch: | |
description: "The target branch from Bioc" | |
required: true | |
default: "devel" | |
name: "Connect to Bioconductor Repository" | |
jobs: | |
push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo ⬇️ | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Connect to Bioconductor Repository | |
run: | | |
wd=$PWD | |
#--- log setup: log everything in log/log.out | |
mkdir -p log | |
exec 1>log/log.out 2>&1 | |
set -ex | |
#--- ssh setup | |
mkdir ~/.ssh | |
cp .github/config ~/.ssh/config | |
cd ~/.ssh | |
ssh-agent /bin/sh | |
eval `ssh-agent -s` | |
ssh-add - <<< "$SSH_KEY" | |
ssh-keyscan $BIOC_HOST > ~/.ssh/known_hosts | |
cd $wd | |
#--- git config | |
git config user.name '$MAINTAINER_NAME' | |
git config user.email '$MAINTAINER_EMAIL' | |
git remote add bioc git@git.bioconductor.org:packages/mixOmics.git | |
#--- | |
git fetch --all # for logs in case of failure | |
source_branch=${{ github.event.inputs.source_branch }} | |
bioc_branch=${{ github.event.inputs.bioc_branch }} | |
if [ "${{ github.event.inputs.action }}" == "push" ]; then | |
git push bioc $source_branch:$bioc_branch | |
elif [ "${{ github.event.inputs.action }}" == "pull" ]; then | |
git merge -X theirs bioc/$bioc_branch --no-edit | |
git push origin $source_branch:$bioc_branch | |
else | |
# show diffs | |
git checkout -b tmp | |
git reset --hard bioc/$bioc_branch | |
echo "source vs bioc:\n\n" | |
git log $source_branch..tmp --oneline --decorate | |
echo "bioc vs source:\n\n" | |
git log tmp..$source_branch --oneline --decorate | |
fi | |
env: | |
SSH_KEY: ${{ secrets.PRIVATE_SSH_KEY_BIOC_MAINTAINER }} | |
BIOC_HOST: ${{ secrets.BIOC_HOST }} | |
MAINTAINER_NAME: ${{ secrets.MAINTAINER_NAME }} | |
MAINTAINER_EMAIL: ${{ secrets.MAINTAINER_EMAIL }} | |
- name: Upload Logs | |
if: always() | |
uses: actions/upload-artifact@master | |
with: | |
name: log | |
path: log |