-
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 pull request #21 from fisuda/v0.2.0-next
Bump: 0.2.0-next -> 0.3.0
- Loading branch information
Showing
15 changed files
with
315 additions
and
41 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
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,18 @@ | ||
on: | ||
pull_request: | ||
branches: [main] | ||
types: [closed] | ||
|
||
jobs: | ||
create-release-tag: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
REPO: ${{ github.repository }} | ||
TZ: 'Asia/Tokyo' | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run release | ||
run: ./maintenance/release.sh |
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 |
---|---|---|
|
@@ -24,3 +24,5 @@ ngsi-v* | |
*.jar | ||
setup_ngsi_go.sh | ||
.install | ||
*.tar.gz | ||
*.tgz |
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
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
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
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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
VERSION=0.2.0 | ||
VERSION=0.3.0 |
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
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
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,131 @@ | ||
#!/bin/bash | ||
|
||
# MIT License | ||
# | ||
# Copyright (c) 2023 Kazuhito Suda | ||
# | ||
# This file is part of FIWARE Small Bang | ||
# | ||
# https://github.com/lets-fiware/FIWARE-Small-Bang | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
set -ue | ||
|
||
cd "$(dirname "$0")" | ||
cd .. | ||
|
||
TAG=$(cat VERSION) | ||
TAG="v${TAG##*=}" | ||
VER=${TAG//v/} | ||
echo "TAG: ${TAG}" | ||
echo "VER: ${VER}" | ||
|
||
if echo "${TAG}" | grep -q "-next" | ||
then | ||
exit 0 | ||
fi | ||
|
||
if git tag | grep -q "${TAG}" | ||
then | ||
exit 0 | ||
fi | ||
|
||
AUTHOR_NAME=$(jq -r '.pull_request.merged_by.login' "$GITHUB_EVENT_PATH") | ||
AUTHOR_EMAIL=$(jq -r '.pull_request.merged_by.email' "$GITHUB_EVENT_PATH") | ||
|
||
git config user.name "${AUTHOR_NAME}" | ||
git config user.email "${AUTHOR_EMAIL}" | ||
git tag "${TAG}" | ||
git push origin "${TAG}" | ||
|
||
NAME=${REPO##*/} | ||
|
||
echo "NAME: ${NAME}" | ||
echo "REPO: ${REPO}" | ||
|
||
FILE=CHANGELOG.md | ||
LINES=$(grep -n "^##" -m 2 "${FILE}" | sed -e 's/:.*//g'| sed -z "s/\n/,/g" | sed "s/,$//") | ||
CHANGE_LOG=$(sed -n "${LINES}p" "${FILE}" | sed -e "/^$/d" -e "/^##/d" | sed -z "s/\n/\\\\n/g") | ||
echo "${CHANGE_LOG}" | ||
|
||
RES=$(curl -X POST \ | ||
-H "Authorization: token ${GITHUB_TOKEN}" \ | ||
-d "{ \"tag_name\": \"${TAG}\", \"name\": \"${NAME//-/ } ${TAG}\", \"body\": \"${CHANGE_LOG}\"}" \ | ||
"https://api.github.com/repos/${REPO}/releases") | ||
|
||
# Create tar.gz file | ||
|
||
DIR="${NAME}-${TAG//v/}" | ||
mkdir "${DIR}" | ||
|
||
for FILE in LICENSE README.md config.sh setup-fiware.sh | ||
do | ||
cp -a "${FILE}" "${DIR}/" | ||
done | ||
|
||
# for FILE in examples | ||
# do | ||
# cp -ar "${FILE}" "${DIR}/" | ||
# done | ||
cp -ar examples "${DIR}/" | ||
|
||
FILE="${DIR}.tar.gz" | ||
|
||
tar czvf "${FILE}" "${DIR}" | ||
|
||
rm -fr "${DIR}" | ||
|
||
## Upload tar.gz file | ||
|
||
UPLOAD_URL=$(echo "${RES}" | jq '. | .upload_url' | tr -d '"') | ||
UPLOAD_URL="${UPLOAD_URL%%\{*}?name=${FILE}" | ||
echo "UPLOAD URL: ${UPLOAD_URL}" | ||
|
||
curl -L -X POST "${UPLOAD_URL}" -H "Authorization: Bearer ${GITHUB_TOKEN}" \ | ||
-H 'Accept: application/vnd.github+json' \ | ||
-H 'Content-Type: application/gzip' \ | ||
--data-binary "@${FILE}" | ||
|
||
rm -f "${FILE}" | ||
|
||
## Create -next branch | ||
|
||
git switch -c "${TAG}-next" | ||
git push origin "${TAG}-next" | ||
|
||
## Create branch | ||
git switch -c "release/${VER}_next" | ||
|
||
VER_SED=${VER//\./\\.} | ||
|
||
for FILE in VERSION setup-fiware.sh | ||
do | ||
sed -i -e "s/${VER_SED}/${VER_SED}-next/" "${FILE}" | ||
done | ||
|
||
sed -i "1i ## FIWARE Small Bang v${VER_SED}-next\n" CHANGELOG.md | ||
|
||
git add . | ||
git commit -m "Bump: ${VER} -> ${VER}-next" | ||
git push origin "release/${VER}_next" | ||
|
||
## Create PR | ||
|
||
gh pr create --base "${TAG}-next" --head "release/${VER}_next" --title "Bump: ${VER} -> ${VER}-next" --body "This PR is a preparation for the next release." |
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,109 @@ | ||
#!/bin/bash | ||
set -ue | ||
|
||
# MIT License | ||
# | ||
# Copyright (c) 2023 Kazuhito Suda | ||
# | ||
# This file is part of FIWARE Small Bang | ||
# | ||
# https://github.com/lets-fiware/FIWARE-Small-Bang | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
LANG=C | ||
LC_TIME=C | ||
|
||
version_up() { | ||
FISB_HOME=$PWD | ||
OLD=$1 | ||
NEW=$(echo "${OLD}" | awk -F \. -v 'OFS=.' '{print $1, $2+1,$3 }') | ||
|
||
BRANCH="release/${NEW}" | ||
DATE=$(date "+%d %B, %Y") | ||
|
||
git switch -c "${BRANCH}" | ||
|
||
sed -i "1s/${OLD}-next/${NEW} - ${DATE}/" "${FISB_HOME}/CHANGELOG.md" | ||
|
||
for file in README.md README_ja.md VERSION docs/en/installation.md docs/ja/installation.md setup-fiware.sh | ||
do | ||
file="${FISB_HOME}/${file}" | ||
ls -l "${file}" | ||
sed -i -e "s/${OLD}.tar.gz/${NEW}.tar.gz/" "${file}" | ||
sed -i -e "s/FIWARE-Small-Bang-${OLD}/FIWARE-Small-Bang-${NEW}/" "${file}" | ||
sed -i -e "s/${OLD}-next/${NEW}/" "${file}" | ||
sed -i -e "s/v${OLD}/v${NEW}/" "${file}" | ||
done | ||
|
||
sed -i -e "s/${OLD}-next/${NEW}/" "${FISB_HOME}/config.sh" | ||
|
||
sed -i -e "s/${OLD}-next/${NEW}-next/" "${FISB_HOME}/.github/pull_request_template.md" | ||
sed -i -e "s/${OLD}-next/${NEW}-next/" "${FISB_HOME}/CONTRIBUTING.md" | ||
|
||
sed -i -e "s/${OLD}/${NEW}/" "${FISB_HOME}/SECURITY.md" | ||
|
||
git add . | ||
git commit -m "Bump: ${OLD}-next -> ${NEW}" | ||
git push origin "${BRANCH}" | ||
} | ||
|
||
next_version() { | ||
FISB_HOME=$PWD | ||
VER=$1 | ||
|
||
BRANCH="release/${VER}_next" | ||
|
||
git switch -c "${BRANCH}" | ||
|
||
for file in VERSION setup-fiware.sh | ||
do | ||
file="${FISB_HOME}/${file}" | ||
ls -l "${file}" | ||
sed -i -e "s/${VER}/${VER}-next/" "${file}" | ||
done | ||
|
||
sed -i "1i ## FIWARE Small Bang v${VER}-next\n" "${FISB_HOME}/CHANGELOG.md" | ||
|
||
git add . | ||
git commit -m "Bump: ${VER} -> ${VER}-next" | ||
git push origin "${BRANCH}" | ||
} | ||
|
||
main() { | ||
if ! [ -e VERSION ]; then | ||
echo "VERSION file not found" | ||
exit 1 | ||
fi | ||
|
||
VERSION=$(sed "s/VERSION=//" VERSION | sed "s/-next//" | awk -F \. -v 'OFS=.' '{print $1, $2,$3 }') | ||
|
||
set +e | ||
RESULT=$(grep -ic -next VERSION) | ||
set -e | ||
|
||
if [ "${RESULT}" -eq 1 ]; then | ||
version_up ${VERSION} | ||
else | ||
echo "next version" | ||
next_version ${VERSION} | ||
fi | ||
} | ||
|
||
main "$@" |
Oops, something went wrong.