Attempt number one at copying SourceForge SVN to GitHub using Actions
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7314 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
56331beada
commit
7371f3b22d
2 changed files with 154 additions and 0 deletions
129
.github/workflows/copy-svn.yml
vendored
Normal file
129
.github/workflows/copy-svn.yml
vendored
Normal file
|
@ -0,0 +1,129 @@
|
|||
# to boostrap this action, create an empty repo with just this file and svn-authors
|
||||
# run the action once with force parameter set to "yes"
|
||||
|
||||
# git commit -m "xxx" * && git push -f && gh workflow run -R kichik/nsis-travis copy-svn.yml -f force=yes
|
||||
|
||||
name: Copy from SourceForge Subversion
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
force:
|
||||
description: 'Force push (CAREFUL!)'
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
copy:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install git-svn
|
||||
run: sudo add-apt-repository ppa:git-core/ppa && sudo apt update && sudo apt install git-svn
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config --global user.email "kichik@gmail.com"
|
||||
git config --global user.name "Amir Szekely"
|
||||
|
||||
- name: Restore cache
|
||||
id: restore-cache
|
||||
run: |
|
||||
if git fetch origin svn2git-cache; then
|
||||
git checkout svn2git-cache
|
||||
else
|
||||
git checkout --orphan svn2git-cache
|
||||
git rm -rf --cached .
|
||||
git add .github/workflows/*
|
||||
git commit -m "Empty cache"
|
||||
echo '::set-output name=cache-hit::false'
|
||||
fi
|
||||
|
||||
if [ -f svn2git-cache.tar.gz ]; then
|
||||
tar xzf svn2git-cache.tar.gz
|
||||
echo '::set-output name=cache-hit::true'
|
||||
else
|
||||
echo '::set-output name=cache-hit::false'
|
||||
fi
|
||||
|
||||
- name: Initial SVN clone
|
||||
if: steps.restore-cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
git svn clone -A.github/workflows/svn-authors -s https://svn.code.sf.net/p/nsis/code/NSIS svn2git
|
||||
|
||||
- name: SVN fetch
|
||||
working-directory: svn2git
|
||||
run: |
|
||||
git svn fetch --fetch-all
|
||||
git svn rebase
|
||||
|
||||
- name: SVN branches
|
||||
working-directory: svn2git
|
||||
run: |
|
||||
for remote_branch in $(git branch -r | grep -v /tags/); do
|
||||
if echo $remote_branch | grep @; then
|
||||
echo ignoring weird branch $remote_branch
|
||||
continue
|
||||
fi
|
||||
|
||||
local_branch=`echo $remote_branch | cut -d / -f 2-`
|
||||
git checkout -b "$local_branch" "$remote_branch" || git checkout "$local_branch"
|
||||
git svn rebase
|
||||
done
|
||||
git checkout master
|
||||
|
||||
- name: SVN tags
|
||||
working-directory: svn2git
|
||||
run: |
|
||||
git tag
|
||||
|
||||
git for-each-ref --format="%(refname:short) %(objectname)" refs/remotes/origin/tags \
|
||||
| while read BRANCH REF
|
||||
do
|
||||
TAG_NAME=`echo $BRANCH | cut -d / -f 3-`
|
||||
BODY="$(git log -1 --format=format:%B $REF)"
|
||||
|
||||
echo "ref=$REF parent=$(git rev-parse $REF^) tagname=$TAG_NAME body=$BODY" >&2
|
||||
git tag -l "$TAG_NAME"
|
||||
echo XXX
|
||||
|
||||
if [ $(git tag -l "$TAG_NAME") ]; then
|
||||
echo tag already exists
|
||||
else
|
||||
git tag -a -m "$BODY" $TAG_NAME $REF^
|
||||
#git branch -r -d $BRANCH
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Setup GitHub access
|
||||
env:
|
||||
SSH_KEY: ${{ secrets.SSH_KEY }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
touch ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
echo "$SSH_KEY" >> ~/.ssh/id_ed25519
|
||||
|
||||
- name: Push to GitHub
|
||||
working-directory: svn2git
|
||||
run: |
|
||||
flags=""
|
||||
if [[ "${{ github.event.inputs.force }}" = "yes" ]]; then
|
||||
flags="--force"
|
||||
fi
|
||||
remote_repo="git@github.com:${GITHUB_REPOSITORY}.git"
|
||||
git push "$remote_repo" --all $flags
|
||||
git push "$remote_repo" --tags $flags
|
||||
|
||||
- name: GC
|
||||
working-directory: svn2git
|
||||
run: |
|
||||
echo run garbage collection so caching does not fail while files are changing
|
||||
git gc --auto
|
||||
|
||||
- name: Save cache
|
||||
run: |
|
||||
rm -f svn2git-cache.tar.gz
|
||||
tar czf svn2git-cache.tar.gz svn2git
|
||||
git add svn2git-cache.tar.gz
|
||||
git commit --amend -m "update cache" svn2git-cache.tar.gz
|
||||
git push --force origin svn2git-cache
|
25
.github/workflows/svn-authors
vendored
Normal file
25
.github/workflows/svn-authors
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
(no author) = No Author <no_author@no_author>
|
||||
anoncvs_ezcontents = No Author <no_author@no_author>
|
||||
anders_k = Anders <anders_k@users.sourceforge.net>
|
||||
eccles = Dave Laundon <eccles@users.sourceforge.net>
|
||||
joostverburg = Joost Verburg <joostverburg@users.sourceforge.net>
|
||||
justin1014 = Justin Frankel <justin1014@users.sourceforge.net>
|
||||
kichik = Amir Szekely <kichik@users.sourceforge.net>
|
||||
sunjammerx = Ximon Eighteen <sunjammerx@users.sourceforge.net>
|
||||
afrow_uk = Stuart <afrow_uk@users.sourceforge.net>
|
||||
ballison = Ben Allison <ballison@users.sourceforge.net>
|
||||
f0rt = f0rt <f0rt@users.sourceforge.net>
|
||||
flizebogen = Flizebogen <flizebogen@users.sourceforge.net>
|
||||
gavenkoa = Oleksandr Gavenko <gavenkoa@users.sourceforge.net>
|
||||
golubdr = David Golub <golubdr@users.sourceforge.net>
|
||||
icemank = Sunil Kamath <icemank@users.sourceforge.net>
|
||||
jimpark = Jim Park <jimpark@users.sourceforge.net>
|
||||
oripel = Ori Peleg <oripel@users.sourceforge.net>
|
||||
pabs3 = Paul Wise <pabs3@users.sourceforge.net>
|
||||
ramon18 = Ramon <ramon18@users.sourceforge.net>
|
||||
whyeye = Jan T. Sott <whyeye@users.sourceforge.net>
|
||||
wizou = Wizou <wizou@users.sourceforge.net>
|
||||
rainwater = Robert Rainwater <rainwater@users.sourceforge.net>
|
||||
uid27073 = Robert Rainwater <rainwater@users.sourceforge.net>
|
||||
zarg = zarg <zarg@users.sourceforge.net>
|
||||
o_owd = o_owd <o_owd@users.sourceforge.net>
|
Loading…
Add table
Add a link
Reference in a new issue