Skip to content

Commit

Permalink
Merge branch 'issues/58_release_2015-10-03' into issues/58_release_20…
Browse files Browse the repository at this point in the history
…16-08-14
  • Loading branch information
mhoffrog committed Mar 31, 2022
2 parents d681a18 + 325f92e commit 40421d4
Show file tree
Hide file tree
Showing 3 changed files with 318 additions and 0 deletions.
205 changes: 205 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# ------------------------------------------------------------------------------------------
# This is a workflow to release this project as a zipped installable artifact.
# Release version numbering and release notes generation is following standards defined by:
#
# https://semver.org
# https://keepachangelog.com
# https://common-changelog.org
#
# Note: Since DokuWiki is using version numbering in format YYYY-MM-DD we use this numbering
# format rather than a dotted numbering scheme.
# The git tag names have to use a 'v' as prefix to the DokuWiki version number.
#
# ------------------------------------------------------------------------------------------
name: Build a release

on:
# Triggers the workflow on push of a tag filtering the tag to meet
# semantic version numbering according to https://semver.org
# Here we use the DokuWiki conform version number pattern.
push:
tags:
['v[0-9]+-[0-9]+-[0-9]+']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
# Ensure that we run on tag references only
validate_github_reference:
name: Validate the tag reference
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Validate tag
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
steps:
- run: |
echo "The selected git ref=${{ github.ref }} is NOT a valid release tag. Please select a valid release TAG as reference."
exit 1
# Create a release
release:
name: Release
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Set job wide environment
env:
APP_NAME: dokuwiki-plugin-gitbacked
APP_INFO_FILE: plugin.info.txt
APP_INFO_FILE_VERSION_KEY: date
BUILD_DIR: build
ZIP_EXCLUSIONS: '*.git* .editorconfig /*.github/* /*build/* RELEASE_HEAD.md'

steps:
# Log use case if triggered manually
- name: Log use case if triggered manually
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "Workflow has been triggered manually"
# Log use case if triggered by push
- name: Log use case if triggered by push
if: ${{ github.event_name == 'push' }}
run: |
echo "Workflow has been triggered by push to ${{ github.ref }}"
# Check out this repo
- name: Checkout
uses: GHCICD/checkout@v3

# Set version tags as global environment properties
- name: Prepare Version Tags
run: |
#echo "MAJOR_VERSION=$(echo ${GITHUB_REF/refs\/tags\//} | awk -F'-' '{print $1}')" >> $GITHUB_ENV
#echo "MINOR_VERSION=$(echo ${GITHUB_REF/refs\/tags\//} | awk -F'-' '{print $1"-"$2}')" >> $GITHUB_ENV
#echo "FULL_VERSION=$(echo ${GITHUB_REF/refs\/tags\//} | awk -F'-' '{print $1"-"$2"-"$3}')" >> $GITHUB_ENV
echo "VERSION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
echo "APP_INFO_VERSION=$(sed -n -E 's/^${{ env.APP_INFO_FILE_VERSION_KEY }}[ \t]+([0-9-]+).*/\1/p' ${{ env.APP_INFO_FILE }})" >> $GITHUB_ENV
# Validate app info version and set release name
- name: Validate app info version and set release name
run: |
if [ "${{ env.RELEASE_VERSION }}" != "${{ env.APP_INFO_VERSION }}" ]; then
echo "Mismatch of release version=${{ env.RELEASE_VERSION }} and application info version=${{ env.APP_INFO_VERSION }}!" >&2
echo "Please review the value for key=${{ env.APP_INFO_FILE_VERSION_KEY }} in file ${{ env.APP_INFO_FILE }}."
exit 1
fi
echo "RELEASE_NAME=Release ${{ env.APP_INFO_VERSION }}" >> $GITHUB_ENV
- name: Validate CHANGELOG.md for this release version
# explanation of sed command:
# 1. select lines between SED_VERSION_BEGIN_PATTERN and SED_VERSION_END_PATTERN
# 2. invert this selection
# 3. delete it
# => only selection is remaining in stream
run: |
SED_VERSION_BEGIN_PATTERN="/^## \\[${{ env.RELEASE_VERSION }}\\]/"
SED_VERSION_END_PATTERN="/^## /"
echo "Pattern used for sed: ${SED_VERSION_BEGIN_PATTERN},${SED_VERSION_END_PATTERN} ! d"
#
# Extract the release notes for this RELEASE_VERSION including the line of the previous version:
#
RELEASE_NOTES_WITH_PREV_VERSION=$(sed -e "${SED_VERSION_BEGIN_PATTERN},${SED_VERSION_END_PATTERN} ! d" CHANGELOG.md)
echo ">>>>>> RELEASE_NOTES_WITH_PREV_VERSION - BEGIN >>>>>>"
echo "${RELEASE_NOTES_WITH_PREV_VERSION}"
echo "<<<<<< RELEASE_NOTES_WITH_PREV_VERSION - END <<<<<<"
#
# Format the release notes:
#
# 1. Remove last 2 lines: head -n 2
# 2. Remove any empty line from the end: sed -e :a -e '/^\n*$/{$d;N;ba' -e '}'
# (s. http://sed.sourceforge.net/sed1line.txt for reference)
#
#RELEASE_VERSION_NOTES=$(echo "$RELEASE_NOTES_WITH_PREV_VERSION" | head -n -2 | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}')
#echo "${RELEASE_VERSION_NOTES}" >> RELEASE.md
#printf "\n" >> RELEASE.md
#
# Extract previous release version:
#
# 1. Cut the last line only: tail -1
# 2. Get the version from the enclosing [] brackets: awk -F "[][]" '{ print $2 }'
#
PREV_RELEASE_VERSION=$(echo "$RELEASE_NOTES_WITH_PREV_VERSION" | tail -1 | awk -F "[][]" '{ print $2 }')
if [ -z "$PREV_RELEASE_VERSION" ]; then
EXPECTED_COMPARE_URL="${{ github.server_url }}/${{ github.repository }}/releases/tag/v${{ env.RELEASE_VERSION }}"
else
EXPECTED_COMPARE_URL="${{ github.server_url }}/${{ github.repository }}/compare/v${PREV_RELEASE_VERSION}..v${{ env.RELEASE_VERSION }}"
fi
# Validate CHANGELOG.md content
IS_OK="true"
if ! grep -q "^## \\[${{ env.RELEASE_VERSION }}\\]" CHANGELOG.md; then
IS_OK="false"
echo "ERROR: CHANGELOG.md does not contain an entry for this release version of format: ## [${{ env.RELEASE_VERSION }}]"
fi
if ! grep -q "^\\[${{ env.RELEASE_VERSION }}\\]: ${EXPECTED_COMPARE_URL}" CHANGELOG.md; then
IS_OK="false"
echo "ERROR: CHANGELOG.md does not contain a line with a compare link of format: [${{ env.RELEASE_VERSION }}]: ${EXPECTED_COMPARE_URL}"
fi
if [ "$IS_OK" != "true" ]; then
echo "Please review CHANGELOG.md and update it for the content expected."
exit 1
fi
# Prepare release notes and build directory
- name: Prepare release notes and build directory
run: |
mkdir ${{ env.BUILD_DIR }}
#cp ./README.md ${{ env.BUILD_DIR }}/README.md
touch ${{ env.BUILD_DIR }}/README.md
cp ./CHANGELOG.md ${{ env.BUILD_DIR }}/CHANGELOG.md
cp ./.github/workflows/resources/RELEASE_HEAD.md ${{ env.BUILD_DIR }}/RELEASE_HEAD.md
# Format the filename of this release
- name: Format release filename
id: format_release_filename
run: |
echo "::set-output name=FILE_NAME::${{ env.APP_NAME }}-${{ env.APP_INFO_VERSION }}.zip"
# Create archive file
- name: Build release archive
uses: GHCICD/zip-release@master
with:
type: 'zip'
filename: ${{ env.BUILD_DIR }}/${{ steps.format_release_filename.outputs.FILE_NAME }}
exclusions: ${{ env.ZIP_EXCLUSIONS }}

# Create release notes by release-notes-from-changelog
- name: Create release notes by GHCICD/release-notes-from-changelog@v1
uses: GHCICD/release-notes-from-changelog@v1
with:
version: ${{ env.RELEASE_VERSION }}
working-directory: ${{ env.BUILD_DIR }}

- name: Log RELEASE.md
run: |
echo ">>>>> build/RELEASE.md:"
cat ${{ env.BUILD_DIR }}/RELEASE.md
echo "<<<<<"
# echo ">>>>> build/CHANGELOG.md:"
# cat ${{ env.BUILD_DIR }}/CHANGELOG.md
# echo "<<<<<"

# Create release with info from CHANGELOG.md
- name: Create GitHub release by GHCICD/create-release@v1
id: create_release
uses: GHCICD/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_name: ${{ env.RELEASE_NAME }}
tag_name: ${{ env.VERSION_TAG }}
body_path: ${{ env.BUILD_DIR }}/RELEASE.md

- name: Upload release asset to GitHub by GHCICD/upload-release-asset@v1
uses: GHCICD/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.BUILD_DIR }}/${{ steps.format_release_filename.outputs.FILE_NAME }}
asset_name: ${{ steps.format_release_filename.outputs.FILE_NAME }}
asset_content_type: application/zip
#
# EOF
#
5 changes: 5 additions & 0 deletions .github/workflows/resources/RELEASE_HEAD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dokuwiki-plugin-gitbacked

gitbacked Plugin for DokuWiki - Store/Sync pages and media files in a git repository

Release notes for this version:
108 changes: 108 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

<!-- Format restrictions - see https://common-changelog.org and https://keepachangelog.com/ for details -->
<!-- Each Release must start with a line for the release version of exactly this format: ## [version] -->
<!-- The subsequent comment lines start with a space - not to irritate the release scripts parser!
## [yyyy-mm-dd]
<empty line> - optional sub sections may follow like:
### Added:
- This feature was added
<empty line>
### Changed:
- This feature was changed
<empty line>
### Removed:
- This feature was removed
<empty line>
### Fixed:
- This issue was fixed
<empty line>
<empty line> - next line is the starting of the previous release
## [yyyy-mm-dd]
<empty line>
<...>
!!! In addition the compare URL links are to be maintained at the end of this CHANGELOG.md as follows.
These links provide direct access to the GitHub compare vs. the previous release.
The particular link of a released version will be copied to the release notes of a release accordingly.
At the end of this file appropriate compare links have to be maintained for each release version in format:
+-current release version
|
| +-URL to this repo previous release version tag-+ +-current release version tag
| | | |
[yyyy-mm-dd]: https://github.com/woolfg/dokuwiki-plugin-gitbacked/compare/vYYYY-MM-DD..vYYYY-MM-DD
-->
<!--
## [Unreleased]
### Added
- TBD
### Changed
- TBD
### Deprecated
- TBD
### Removed
- TBD
### Fixed
- TBD
### Security
- TBD
-->

## [Unreleased]

### Changed
- TBD


## [2015-10-03]

### Added
- Allow name and mail user variables in addParams.
- Add an option for customizing git working tree
- Added setting ignorePaths to ignore specified paths in add/commit-process

### Changed
- Use Markdown for the GitHub README.
- Update plugin date and URL, added Carsten Teibes as author
- Pull latest git php library (0.1.4)
- Allow to set the path to the git binary - implements #8
- Use relative path for Git.php and `$conf['tempdir']` for temp file.
- Coding compliance change: move handle_periodic_pull down, together with other "handle"s.

### Fixed
- Fix passing additional arguments to git binary
- Fix lang typos.
- Coding compliance change, tabs to spaces, fix typos.
- dokuwiki Farm fix


## [2012-10-31]

### Added
- Initial release

### Comments
- The release name complies with the date property of plugin.info.txt
- The recent commit within this release is [2dbc1a5](https://github.com/woolfg/dokuwiki-plugin-gitbacked/commit/2dbc1a5564516b801dbda239b68152edb5be0303) of 13-Nov-2012

<!--
## []
### NeverReleased
- This is just a dummy placeholder to make the parser of GHCICD/release-notes-from-changelog@v1 happy!
-->

[Unreleased]: https://github.com/woolfg/dokuwiki-plugin-gitbacked/compare/v2015-10-03..HEAD
[2015-10-03]: https://github.com/woolfg/dokuwiki-plugin-gitbacked/compare/v2012-10-31..v2015-10-03
[2012-10-31]: https://github.com/woolfg/dokuwiki-plugin-gitbacked/releases/tag/v2012-10-31

0 comments on commit 40421d4

Please sign in to comment.