Create branch on new tag in finschia #411
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
name: Create branch on new tag in finschia | |
on: | |
schedule: | |
# Every day | |
- cron: "0 1 * * *" | |
jobs: | |
create-bump-up-PR: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set current tag to env | |
run: | | |
CURRENT_TAG=$(curl "https://api.github.com/repos/Finschia/finschia-proto/tags" | jq -r '.[0].name') | |
echo "CURRENT_TAG=$CURRENT_TAG" >> $GITHUB_ENV | |
- name: Check out to finschia | |
uses: actions/checkout@master | |
with: | |
repository: Finschia/finschia | |
fetch-depth: 0 | |
- name: Check new tag released | |
run: | | |
NEW_TAG=$(curl "https://api.github.com/repos/Finschia/finschia/tags" | jq -r '.[0].name') | |
if [ ${{ env.CURRENT_TAG }} != $NEW_TAG ] && \ | |
[ "$(git branch -r | grep "auto-bump-up/${NEW_TAG}")" == "" ]; then \ | |
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV; \ | |
git checkout $NEW_TAG | |
fi | |
- name: Set each submodule version to env | |
if: env.NEW_TAG | |
run: | | |
FINSCHIA_SDK_VERSION=$(grep 'github.com/Finschia/finschia-sdk' go.mod | awk '{print $2}' | awk -F '-' '{if ($3 != "") {print $3} else if ($2 != "") {print $1"-"$2} else {print $1}}') | |
WASMD_VERSION=$(grep 'github.com/Finschia/wasmd' go.mod | awk '{print $2}' | awk -F '-' '{if ($3 != "") {print $3} else if ($2 != "") {print $1"-"$2} else {print $1}}') | |
IBC_GO_VERSION=$(grep 'github.com/cosmos/ibc-go' go.mod | grep -v '=>' | awk '{print $2}' | awk -F '-' '{if ($3 != "") {print $3} else if ($2 != "") {print $1"-"$2} else {print $1}}') | |
echo "FINSCHIA_SDK_VERSION=$FINSCHIA_SDK_VERSION" >> $GITHUB_ENV | |
echo "WASMD_VERSION=$WASMD_VERSION" >> $GITHUB_ENV | |
echo "IBC_GO_VERSION=$IBC_GO_VERSION" >> $GITHUB_ENV | |
- name: Check out to finschia-proto | |
if: env.NEW_TAG | |
uses: actions/checkout@v3 | |
with: | |
repository: Finschia/finschia-proto | |
- name: init submodule | |
if: env.NEW_TAG | |
run: git submodule update --init --remote | |
- name: set each submodule version to env file | |
if: env.NEW_TAG | |
run: | | |
echo '# Choose from https://github.com/Finschia/finschia/releases' | cat > env | |
echo FINSCHIA_VERSION=${{ env.NEW_TAG }} | cat >> env | |
echo FINSCHIA_SDK_VERSION=${{ env.FINSCHIA_SDK_VERSION }} | cat >> env | |
echo WASMD_VERSION=${{ env.WASMD_VERSION }} | cat >> env | |
echo IBC_GO_VERSION=${{ env.IBC_GO_VERSION }} | cat >> env | |
- name: Install protoc | |
if: env.NEW_TAG | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: "3.14.0" | |
- name: run build | |
if: env.NEW_TAG | |
run: | | |
chmod +x ./build.sh | |
bash -xe build.sh | |
- name: Install Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 14 | |
- name: Install Dependencies | |
run: npm install -g prettier | |
- name: Lint Markdown | |
run: prettier --write README.md | |
- name: Create Pull Request | |
if: env.NEW_TAG | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
commit-message: Automated bump up ${{ env.NEW_TAG }} | |
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com> | |
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> | |
branch: auto-bump-up/${{ env.NEW_TAG }} | |
labels: automated pr | |
title: bump up finschia ${{ env.NEW_TAG }} into main | |
base: main |