forked from kichik/nsis
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/conda/nsis-mirror
- Loading branch information
Showing
3 changed files
with
110 additions
and
45 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,17 +4,36 @@ | |
# 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: | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
force: | ||
description: 'Force push (CAREFUL!)' | ||
options: ["no", "yes"] | ||
type: choice | ||
required: false | ||
schedule: | ||
- cron: '4 10 * * *' | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
# Concurrency group that uses the workflow name and PR number if available | ||
# or commit SHA as a fallback. If a new build is triggered under that | ||
# concurrency group while a previous build is running it will be canceled. | ||
# Repeated pushes to a PR will cancel all previous builds, while multiple | ||
# merges to main will not cancel. | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
copy: | ||
permissions: | ||
contents: write # for Git to git push | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -24,32 +43,21 @@ jobs: | |
|
||
- name: Configure git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Amir Szekely" | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
- 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 "cache-hit=false" >> $GITHUB_OUTPUT | ||
fi | ||
if [ -f svn2git-cache.tar.gz ]; then | ||
tar xzf svn2git-cache.tar.gz | ||
echo "cache-hit=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "cache-hit=false" >> $GITHUB_OUTPUT | ||
fi | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
svn2git | ||
key: svn2git-${{ github.event.pull_request.number || github.ref_name }} | ||
|
||
- name: Initial SVN clone | ||
if: steps.restore-cache.outputs.cache-hit != 'true' | ||
run: | | ||
git config --global init.defaultBranch main | ||
git svn clone -A.github/workflows/svn-authors -s https://svn.code.sf.net/p/nsis/code/NSIS svn2git | ||
- name: SVN fetch | ||
|
@@ -66,61 +74,55 @@ jobs: | |
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 | ||
git checkout main # this is the default branch inside `svn2git` | ||
- name: SVN tags | ||
working-directory: svn2git | ||
id: svn_tags | ||
run: | | ||
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-` | ||
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 | ||
if [ $(git tag -l "$TAG_NAME") ]; then | ||
echo tag already exists | ||
if [ $(git tag -l "$TAG_NAME" 2>/dev/null) ]; then | ||
echo "tag already exists" | ||
else | ||
git tag -a -m "$BODY" $TAG_NAME $REF^ | ||
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 | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
flags="" | ||
if [[ "${{ github.event.inputs.force }}" = "yes" ]]; then | ||
flags="--force" | ||
fi | ||
remote_repo="[email protected]:${GITHUB_REPOSITORY}.git" | ||
remote_repo="https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | ||
git pull "$remote_repo" main --no-rebase --tags -X theirs | ||
git push "$remote_repo" --all $flags | ||
git push "$remote_repo" --tags $flags | ||
- name: GC | ||
working-directory: svn2git | ||
if: always() | ||
run: | | ||
echo run garbage collection so caching does not fail while files are changing | ||
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 | ||
cp svn2git/.github/workflows/* .github/workflows/ | ||
git add .github/workflows/* | ||
git commit --amend -m "update cache" svn2git-cache.tar.gz | ||
git push --force [email protected]:${GITHUB_REPOSITORY}.git svn2git-cache | ||
id: save-cache | ||
uses: actions/cache/save@v3 | ||
if: always() | ||
with: | ||
path: | | ||
svn2git | ||
key: svn2git-${{ github.event.pull_request.number || github.ref_name }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: Tag to manually create a Release of. Use syntax 'refs/tags/XXXX'. | ||
required: true | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
build: | ||
permissions: | ||
contents: write | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Clean tag | ||
run: | | ||
if [[ ${{ github.event_name }} == "workflow_dispatch" ]]; then | ||
tag_ref="${{ github.event.inputs.tag }}" | ||
else | ||
tag_ref="${GITHUB_REF}" | ||
fi | ||
# refs/tags/v308 -> v308 | ||
tag="${tag_ref/refs\/tags\//}" # only tag name | ||
# v308 -> 3 | ||
major_ver="${tag:1:1}" | ||
# v308 -> 3.08, or v3061 -> 3.06.1 | ||
if [[ ${#tag} == 4 ]]; then | ||
major_minor_ver="${tag:1:1}.${tag:2}" | ||
else | ||
major_minor_ver="${tag:1:1}.${tag:2:2}.${tag:4}" | ||
fi | ||
echo "tag_ref=${tag_ref}" >> $GITHUB_ENV | ||
echo "tag=${tag}" >> $GITHUB_ENV | ||
echo "major_ver=${major_ver}" >> $GITHUB_ENV | ||
echo "major_minor_ver=${major_minor_ver}" >> $GITHUB_ENV | ||
- name: Download NSIS | ||
run: | | ||
set -x | ||
for suffix in "-src.tar.bz2" ".zip" "-log.zip" "-strlen_8192.zip"; do | ||
fn="nsis-${major_minor_ver}${suffix}" | ||
curl -L -o "${fn}" "https://sourceforge.net/projects/nsis/files/NSIS%20${major_ver}/${major_minor_ver}/${fn}/download" | ||
done | ||
curl -L -o "RELEASE.html" "https://sourceforge.net/projects/nsis/files/NSIS%20${major_ver}/${major_minor_ver}/RELEASE.html/download" | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.tag }} | ||
name: "NSIS v${{ env.major_minor_ver }}" | ||
body_path: "RELEASE.html" | ||
prerelease: ${{ contains(env.major_minor_ver, 'rc') }} | ||
files: | | ||
nsis-${{ env.major_minor_ver }}.zip | ||
nsis-${{ env.major_minor_ver }}-log.zip | ||
nsis-${{ env.major_minor_ver }}-src.tar.bz2 | ||
nsis-${{ env.major_minor_ver }}-strlen_8192.zip |
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