diff options
-rw-r--r-- | .github/workflows/gitblit-release.yml | 197 | ||||
-rw-r--r-- | build.xml | 87 |
2 files changed, 257 insertions, 27 deletions
diff --git a/.github/workflows/gitblit-release.yml b/.github/workflows/gitblit-release.yml new file mode 100644 index 00000000..24cc4150 --- /dev/null +++ b/.github/workflows/gitblit-release.yml @@ -0,0 +1,197 @@ +name: Release in gitblit/gitblit repo + +on: + push: + tags: + - 'r[0-9]+.[0-9]+.[0-9]+*' + +jobs: + + build_and_test: + name: Build and test + runs-on: ubuntu-latest + if: github.repository == 'fzs/gitblit' + + steps: + - name: Checkout + uses: actions/checkout@v1 + with: + submodules: true + + - name: Setup Java 7 + uses: actions/setup-java@v1 + with: + java-version: 7 + + - name: Report Java version + run: | + java -version + javac -version + + - name: Setup Moxie + run: | + wget http://gitblit.github.io/moxie/maven/com/gitblit/moxie/moxie+ant/0.9.4/moxie+ant-0.9.4.tar.gz + tar -xzf moxie+ant-0.9.4.tar.gz + moxie-0.9.4/bin/moxie -version + + - name: Build with Moxie + run: moxie-0.9.4/bin/moxie test + + + + build_release: + name: Build and deploy release + runs-on: ubuntu-latest + needs: build_and_test + env: + GH_ORG: gitblit + moxie: moxie-0.9.4/bin/moxie + versinfo: ../verinf.sh + + steps: + - name: Setup Java 7 + uses: actions/setup-java@v1 + with: + java-version: 7 + + - name: Report Java version + run: | + java -version + javac -version + + + + - name: Set up Git properties + run: | + set -x + git config --global user.name ${{ github.event.pusher.name }} + git config --global user.email ${{ github.event.pusher.email }} + + - name: Checkout gitblit master for reference + uses: actions/checkout@v2 + with: + path: gitblit-ref + ref: master + fetch-depth: 2 + - name: Fetch all branches in reference + run: | + cd gitblit-ref + git fetch --no-tags --prune --depth=2 origin +refs/heads/*:refs/remotes/origin/* + + - name: Checkout gitblit master from gitblit + uses: actions/checkout@v2 + with: + path: gitblit + repository: ${{ env.GH_ORG }}/gitblit + ref: master + token: ${{ secrets.GITBLIT_RELEASE_PAT }} + fetch-depth: 2 + - name: Fetch all branches from gitblit + run: | + cd gitblit + git fetch --no-tags --prune --depth=2 origin +refs/heads/*:refs/remotes/origin/* + - name: Checkout submodules in gitblit + shell: bash + run: | + cd gitblit + git submodule sync --recursive + git submodule update --init --force --recursive + + - name: Check if gitblit repo is on the same branch and commit as my reference + run: | + cd gitblit-ref + refC=$(git rev-parse HEAD) + refB=$(git symbolic-ref -q --short HEAD) + cd ../gitblit + gbC=$(git rev-parse HEAD) + gbB=$(git symbolic-ref -q --short HEAD) + echo "$refB - $gbB" + if [ "$refB" != "$gbB" ] ; then echo "Not the same branch in refrence and gitblit repo!" ; exit 1 ; fi + echo "refC: $refC" + echo "gbC: $gbC" + if [ "$refC" != "$gbC" ] ; then echo "Different commits in refrence and gitblit repo" ; exit 2 ; fi + continue-on-error: false + + + - name: Checkout gitblit maven repository + uses: actions/checkout@v2 + with: + path: gitblit-maven + repository: ${{ env.GH_ORG }}/gitblit-maven + ref: gh-pages + token: ${{ secrets.GITBLIT_RELEASE_PAT }} + + + - name: Setup Moxie + run: | + wget http://gitblit.github.io/moxie/maven/com/gitblit/moxie/moxie+ant/0.9.4/moxie+ant-0.9.4.tar.gz + tar -xzf moxie+ant-0.9.4.tar.gz + $moxie -version + + + + - name: Create release version + working-directory: gitblit + run: | + ../$moxie -DversionInfo=${versinfo} tagRelease + cat ${versinfo} + . ${versinfo} + echo "Release version $GB_RELEASE_VERSION with tag $GB_RELEASE_TAG" + + + + - name: Build release artifacts + run: | + cd gitblit + ../$moxie clean buildAll buildMavenArtifacts + + - name: Commit Maven artifacts + working-directory: gitblit-maven + run: | + . ${versinfo} + git diff -R -U2 -- artifacts.json | awk 'BEGIN{FS="\n" ; RS="@"; ORS="@"} { for (i=1;i<=NF;i++){if ($i ~ /description/) {print "Skip block";next;}} print $0 }' | sed -e 's/^@@ .* @@Skip block//' -e '/^@$/ d' | patch -p1 artifacts.json + git diff -- artifacts.json + git add . + git commit -m "Release $GB_RELEASE_VERSION artifacts" + + - name: Update website + working-directory: gitblit + run: | + echo "Create local gh-pages branch" + git branch --force --track gh-pages refs/remotes/origin/gh-pages + ../$moxie updateSite + + + + - name: Create release and upload artifacts + env: + GITHUB_TOKEN: ${{ secrets.GITBLIT_RELEASE_PAT }} + working-directory: gitblit + run: ../$moxie releaseBinaries + + - name: Push Maven artifacts to repository + working-directory: gitblit-maven + run: git push origin gh-pages + + - name: Push updated gh-pages and release tag + working-directory: gitblit + run: | + . ${versinfo} + git status + git push origin gh-pages ${GB_RELEASE_TAG} + + - name: Publish GitHub release + env: + GITHUB_TOKEN: ${{ secrets.GITBLIT_RELEASE_PAT }} + working-directory: gitblit + run: ../$moxie publishRelease + + + + - name: Update build identifier and version for next development cycle + working-directory: gitblit + run: | + git checkout master + ../$moxie nextPointReleaseCycle + git push origin + @@ -872,34 +872,27 @@ GB_RELEASE_TAG=${project.tag} </mx:if>
<!-- create the release process script -->
- <mx:if>
- <os family="windows" />
- <then>
- <!-- Windows PowerShell script -->
- <!-- set-executionpolicy remotesigned -->
- <property name="recipe" value="release_${project.version}.ps1" />
- </then>
- <else>
- <!-- Bash script -->
- <property name="recipe" value="release_${project.version}.sh" />
- </else>
- </mx:if>
- <delete file="${recipe}" failonerror="false" quiet="true" verbose="false" />
- <!-- Work-around for lack of proper ant property substitution in copy -->
- <property name="dollar" value="$"/>
- <copy file="release.template" tofile="${recipe}">
- <filterset begintoken="${dollar}{" endtoken="}">
- <filter token="project.version" value="${project.version}" />
- <filter token="project.commitId" value="${project.commitId}" />
- <filter token="project.tag" value="${project.tag}" />
- <filter token="project.directory" value="${basedir}" />
- <filter token="maven.directory" value="${maven.directory}" />
- </filterset>
- </copy>
- <chmod file="${recipe}" perm="ugo+rx" />
+ <createReleaseScript
+ projectVersion="${project.version}"
+ projectTag="${project.tag}"
+ projectCommitId="${project.commitId}" />
</target>
-
+
+ <!--
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ Tag a new version and prepare for the next development cycle.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ -->
+ <target name="releaseScript" depends="prepare" description="create the release process script for a release version">
+ <!-- create the release process script -->
+ <createReleaseScript
+ projectVersion="${project.version}"
+ projectTag="${release.tag}"
+ projectCommitId="${release.tag}" />
+ </target>
+
+
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Prepare for the next point release development cycle.
@@ -927,7 +920,47 @@ GB_RELEASE_TAG=${project.tag} </mx:commit>
</target>
-
+
+
+
+ <!--
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ Create the release process script from the template.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ -->
+ <macrodef name="createReleaseScript">
+ <attribute name="projectVersion" />
+ <attribute name="projectTag" />
+ <attribute name="projectCommitId" />
+ <sequential>
+ <mx:if>
+ <os family="windows" />
+ <then>
+ <!-- Windows PowerShell script -->
+ <!-- set-executionpolicy remotesigned -->
+ <property name="recipe" value="release_@{projectVersion}.ps1" />
+ </then>
+ <else>
+ <!-- Bash script -->
+ <property name="recipe" value="release_@{projectVersion}.sh" />
+ </else>
+ </mx:if>
+ <delete file="${recipe}" failonerror="false" quiet="true" verbose="false" />
+ <!-- Work-around for lack of proper ant property substitution in copy -->
+ <property name="dollar" value="$"/>
+ <copy file="release.template" tofile="${recipe}">
+ <filterset begintoken="${dollar}{" endtoken="}">
+ <filter token="project.version" value="@{projectVersion}" />
+ <filter token="project.commitId" value="@{projectCommitId}" />
+ <filter token="project.tag" value="@{projectTag}" />
+ <filter token="project.directory" value="${basedir}" />
+ <filter token="maven.directory" value="${maven.directory}" />
+ </filterset>
+ </copy>
+ <chmod file="${recipe}" perm="ugo+rx" />
+ </sequential>
+ </macrodef>
+
<!--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build Gitblit Docs
|