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: Build and Push Tag to https://github.com/ECTLab/AIaaS-gRPC-protos-Autogenerated-Python | |
on: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]*.[0-9]*.[0-9]*' | |
repository_dispatch: | |
types: [tag-created] | |
env: | |
DESTINATION_REPO: ECTLab/AIaaS-gRPC-protos-Autogenerated-Python | |
DESTINATION_BRANCH: master | |
DESTINATION_TOKEN: ${{ secrets.PYTHON_DESTINATION_TOKEN }} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- name: Install dependencies | |
run: | | |
make install_python_requirements | |
- name: Build | |
run: | | |
make generate_python_protos | |
- name: Checkout destination repo | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ env.DESTINATION_REPO }} | |
ref: ${{ env.DESTINATION_BRANCH }} | |
token: ${{ env.DESTINATION_TOKEN }} | |
path: destination-repo | |
- name: Copy files | |
run: | | |
rm -rf destination-repo/AIaaS_interface/ | |
mkdir -p destination-repo/AIaaS_interface/ | |
cp -r AIaaS_interface/* destination-repo/AIaaS_interface/ | |
- name: Commit changes | |
run: | | |
bash -c "if [[ ${{ github.ref }} == 'refs/tags/'* ]]; then export TAG_NAME=${{ github.ref }}; fi" | |
echo "Tag name: $TAG_NAME" | |
echo "payload: ${{ github.event.client_payload.tag_name }}" | |
cd destination-repo | |
git config user.email "[email protected]" | |
git config user.name "Mohammad Mahdi Malmasi" | |
git add . | |
git commit -m "Update for tag: $TAG_NAME" | |
git tag $TAG_NAME | |
git push --tags | |
git push origin master | |
env: | |
TAG_NAME: ${{ github.event.client_payload.tag_name }} |