Skip to content

Commit

Permalink
Merge pull request lets-fiware#21 from fisuda/v0.2.0-next
Browse files Browse the repository at this point in the history
Bump: 0.2.0-next -> 0.3.0
  • Loading branch information
fisuda committed Sep 18, 2023
2 parents 85fe16d + f5ae4c0 commit f03a1b9
Show file tree
Hide file tree
Showing 15 changed files with 315 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
If it fixes a bug or resolves a feature request, be sure to link to that issue. Please send a pull request to
the `v0.2.0-next` branch.
the `v0.3.0-next` branch.

## Types of changes

Expand All @@ -23,7 +23,7 @@ merging your code._
- [ ] I have read the [CONTRIBUTING](https://github.com/lets-fiware/FIWARE-Small-Bang/blob/main/CONTRIBUTING.md) doc
- [ ] I have signed the [CLA](https://github.com/lets-fiware/FIWARE-Small-Bang/blob/main/FIWARE-Small-Bang-individual-cla.pdf)
- [ ] I have updated the change log (CHANGELOG.md)
- [ ] I send this pull request to the `v0.2.0-next` branch.
- [ ] I send this pull request to the `v0.3.0-next` branch.
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)
- [ ] Any dependent changes have been merged and published in downstream modules
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ ngsi-v*
*.jar
setup_ngsi_go.sh
.install
*.tar.gz
*.tgz
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## FIWARE Small Bang v0.3.0 - 18 September, 2023

- ADD IP address option (#20)
- UPDATE WireCloud to 1.3.1 and NGSI Proxy to 1.2.2 for arm64 (#19)
- Improve release action (#18)
- ADD release action (#17)

## FIWARE Small Bang v0.2.0 - 13 September, 2023

- ADD Elasticsearch 7.17.13 (#14)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you don't see your idea listed, and you think it fits into the goals of this
- **If your contribution is minor,** such as a typo fix, open a pull request.
- **If your contribution is major,** such as a new guide, start by opening an issue first. That way, other people can
weigh in on the discussion before you do any work.
- Send a pull request to the `v0.2.0-next` branch (not main branch).
- Send a pull request to the `v0.3.0-next` branch (not main branch).

## Community

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ Before running the setup script, you need to install docker and docker compose p
Download a tar.gz file for the FIWARE Small Bang.

```bash
curl -sL https://github.com/lets-fiware/FIWARE-Small-Bang/releases/download/v0.2.0/FIWARE-Small-Bang-0.2.0.tgz | tar zxf -
curl -sL https://github.com/lets-fiware/FIWARE-Small-Bang/releases/download/v0.3.0/FIWARE-Small-Bang-0.3.0.tar.gz | tar zxf -
```

Move to the `FIWARE-Small-Bang-0.2.0` directory.
Move to the `FIWARE-Small-Bang-0.3.0` directory.

```bash
cd FIWARE-Small-Bang-0.2.0/
cd FIWARE-Small-Bang-0.3.0/
```

Run the `setup-fiware.sh` script.
Expand Down
6 changes: 3 additions & 3 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ FI-SB は FIWARE Small Bang の略称です。
FIWARE Small Bang の tar.gz ファイルをダウンロードします。

```bash
curl -sL https://github.com/lets-fiware/FIWARE-Small-Bang/releases/download/v0.2.0/FIWARE-Small-Bang-0.2.0.tgz | tar zxf -
curl -sL https://github.com/lets-fiware/FIWARE-Small-Bang/releases/download/v0.3.0/FIWARE-Small-Bang-0.3.0.tar.gz | tar zxf -
```

`FIWARE-Small-Bang-0.2.0` ディレクトリに移動します。
`FIWARE-Small-Bang-0.3.0` ディレクトリに移動します。

```bash
cd FIWARE-Small-Bang-0.2.0/
cd FIWARE-Small-Bang-0.3.0/
```

`setup-fiware.sh` スクリプトを実行します。
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

| Version | Supported |
| -------- | ------------------ |
| 0.2.0 | :white_check_mark: |
| < 0.2.0 | :x: |
| 0.3.0 | :white_check_mark: |
| < 0.3.0 | :x: |

## Reporting a Vulnerability

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION=0.2.0
VERSION=0.3.0
6 changes: 3 additions & 3 deletions docs/en/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Before running the setup script, you need to install docker and docker compose p
Download a tar.gz file for the FIWARE Small Bang.

```bash
curl -sL https://github.com/lets-fiware/FIWARE-Small-Bang/releases/download/v0.2.0/FIWARE-Small-Bang-0.2.0.tgz | tar zxf -
curl -sL https://github.com/lets-fiware/FIWARE-Small-Bang/releases/download/v0.3.0/FIWARE-Small-Bang-0.3.0.tar.gz | tar zxf -
```

Move to the `FIWARE-Small-Bang-0.2.0` directory.
Move to the `FIWARE-Small-Bang-0.3.0` directory.

```bash
cd FIWARE-Small-Bang-0.2.0/
cd FIWARE-Small-Bang-0.3.0/
```

Run the `setup-fiware.sh` script.
Expand Down
6 changes: 3 additions & 3 deletions docs/ja/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
FIWARE Small Bang の tar.gz ファイルをダウンロードします。

```bash
curl -sL https://github.com/lets-fiware/FIWARE-Small-Bang/releases/download/v0.2.0/FIWARE-Small-Bang-0.2.0.tgz | tar zxf -
curl -sL https://github.com/lets-fiware/FIWARE-Small-Bang/releases/download/v0.3.0/FIWARE-Small-Bang-0.3.0.tar.gz | tar zxf -
```

`FIWARE-Small-Bang-0.2.0` ディレクトリに移動します。
`FIWARE-Small-Bang-0.3.0` ディレクトリに移動します。

```bash
cd FIWARE-Small-Bang-0.2.0/
cd FIWARE-Small-Bang-0.3.0/
```

`setup-fiware.sh` スクリプトを実行します。
Expand Down
131 changes: 131 additions & 0 deletions maintenance/release.sh
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."
109 changes: 109 additions & 0 deletions maintenance/version-up.sh
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 "$@"
Loading

0 comments on commit f03a1b9

Please sign in to comment.