Skip to content

Commit

Permalink
Fix release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tochi-y committed Mar 27, 2020
1 parent 17ed836 commit f89edbe
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 51 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,37 @@ on:
jobs:
build:
runs-on: ubuntu-latest

env:
GITHUB_USER: personiumio
GITHUB_TOKEN: ${{ secrets.PERSONIUM_GITHUB_TOKEN }}
COMPONENT: personium-lib-common

steps:
- uses: actions/checkout@v2
with:
ref: master
- name: git settings
run: |
if [ -z "$GITHUB_USER" -o -z "$GITHUB_TOKEN" ]; then
echo '$GITHUB_USER or $GITHUB_TOKEN is empty.'
exit 1
fi
cat << EOS >~/.netrc
machine github.com
login $GITHUB_USER
password $GITHUB_TOKEN
EOS
git config --global user.name "Personium Bot"
git config --global user.email "[email protected]"
git clone https://github.com/personium/${COMPONENT}.git .
git checkout master
- name: Remove -SNAPSHOT from pom.xml on master branch
run: |
bash ./.github/workflows/scripts/remove-SNAPSHOT.sh
env:
GITHUB_USER: personiumio
GITHUB_TOKEN: ${{ secrets.PERSONIUM_GITHUB_TOKEN }}
- name: Create Release Note
run: |
python3 ./.github/workflows/scripts/create-release-note.py
env:
GITHUB_USER: personiumio
GITHUB_TOKEN: ${{ secrets.PERSONIUM_GITHUB_TOKEN }}
COMPONENT: personium-lib-common

- uses: actions/checkout@v2
with:
ref: develop
- name: Update versions on develop branch
run: |
bash ./.github/workflows/scripts/update-version.sh
env:
GITHUB_USER: personiumio
GITHUB_TOKEN: ${{ secrets.PERSONIUM_GITHUB_TOKEN }}
COMPONENT: personium-lib-common
20 changes: 3 additions & 17 deletions .github/workflows/scripts/remove-SNAPSHOT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,15 @@ echo 'Remove -SNAPSHOT started.'
# Delete -SNAPSHOT
sed -i 's|\-SNAPSHOT||' pom.xml


git branch
git --version
git diff
git add .

git config --global user.name "Personium Bot"
git config --global user.email "[email protected]"

# git commit and push
VERSION=$(
sed -n 's|^ <version>\([0-9]\+\.[0-9]\+\.[0-9]\+\)</version>|\1|p' pom.xml
)
echo ${VERSION}

git diff
git add .
git commit -m "Update to v${VERSION}"

cat << EOS >~/.netrc
machine github.com
login $GITHUB_USER
password $GITHUB_TOKEN
EOS

git remote -v
git push origin master

echo 'Suceeded!'
28 changes: 12 additions & 16 deletions .github/workflows/scripts/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

echo 'Update version started.'

# Check git version
git checkout master

MINOR_VERSION=$(
sed -n 's|^ <version>[0-9]\+\.[0-9]\+\.\([0-9]\+\)-SNAPSHOT</version>|\1|p' pom.xml
sed -n 's|^ <version>[0-9]\+\.[0-9]\+\.\([0-9]\+\)</version>|\1|p' pom.xml
)
if [ -z "$MINOR_VERSION" ]; then
echo 'Cannot get version.'
exit 1
fi

MINOR_VERSION=$((++MINOR_VERSION))
git checkout develop

# update version in pom.xml
sed -i \
Expand All @@ -20,28 +29,15 @@ if [ "${COMPONENT}" = "personium-core" -o "${COMPONENT}" = "personium-engine" ];
fi

# Git commit and push
git branch
git --version
git diff
git add .

git config --global user.name "Personium Bot"
git config --global user.email "[email protected]"

VERSION=$(
sed -n 's|^ <version>\([0-9]\+\.[0-9]\+\.[0-9]\+-SNAPSHOT\)</version>|\1|p' pom.xml
)
echo ${VERSION}

git diff
git add .
git commit -m "Update to v${VERSION}"

cat << EOS >~/.netrc
machine github.com
login $GITHUB_USER
password $GITHUB_TOKEN
EOS

git remote -v
git push origin develop

echo 'Suceeded!'
1 change: 1 addition & 0 deletions test/personium-lib-common
Submodule personium-lib-common added at 697c51

0 comments on commit f89edbe

Please sign in to comment.