sync_types_dev #2
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: Event Sync thrift dev | |
on: | |
repository_dispatch: | |
types: [sync_types_dev] | |
jobs: | |
build-and-push: | |
runs-on: self-hosted | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ssh-key: ${{ secrets.TYPES_REPO_TOKEN }} | |
- name: Clone, copy thrift folder, and include specific files | |
run: | | |
for REPO_NAME in ${{ vars.TARGET_REPOS }} | |
do | |
git clone -b dev https://github.com/alexandriaproject-io/$REPO_NAME.git | |
mkdir -p $REPO_NAME-thrift | |
cp -r $REPO_NAME/thrift $REPO_NAME-thrift/thrift | |
cp $REPO_NAME/thrift_build.sh $REPO_NAME-thrift/thrift_build.sh | |
rm -rf $REPO_NAME | |
done | |
- name: Install Thrift Compiler | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y thrift-compiler | |
- name: Setup and run thrift build script | |
run: | | |
for REPO_NAME in ${{ vars.TARGET_REPOS }} | |
do | |
cd $REPO_NAME-thrift | |
chmod +x thrift_build.sh | |
bash -c "./thrift_build.sh --py ./types/$REPO_NAME/python" | |
bash -c "./thrift_build.sh --html ./types/$REPO_NAME/html" | |
bash -c "./thrift_build.sh --golang ./types/$REPO_NAME/golang" | |
bash -c "./thrift_build.sh --ts ./types/$REPO_NAME/typescript" | |
cd .. | |
cp -r ./$REPO_NAME-thrift/types ./ | |
cp -r ./$REPO_NAME-thrift/thrift ./types/$REPO_NAME/ | |
rm -rf $REPO_NAME-thrift | |
done | |
- name: Commit and push changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git config --global pull.rebase true | |
git add . | |
# Check if there are changes to commit | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit" | |
exit 0 | |
else | |
git commit -m "skip ci" | |
git tag -a "v$(date +'%Y%m%d%H%M%S')" -m "Automated build tag" | |
git push origin HEAD:main --tags | |
fi |