Skip to content

Bump version to 1.2.0 (#637) #454

Bump version to 1.2.0 (#637)

Bump version to 1.2.0 (#637) #454

name: update multitenant dependency
on:
push:
branches:
- main
jobs:
send-pull-requests:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.HASURA_BOT_TOKEN }}
steps:
- name: check out this repository
uses: actions/checkout@v4
with:
path: ndc-postgres
- name: check out ndc-postgres-multitenant
uses: actions/checkout@v4
with:
repository: hasura/ndc-postgres-multitenant
path: ndc-postgres-multitenant
token: ${{ secrets.HASURA_BOT_TOKEN }}
- name: install tools for ndc-postgres-multitenant
working-directory: ndc-postgres-multitenant
run: |
rustup show
- name: send pull request
run: |
set -eux
# get newest commit to use
LATEST_SHA="$(cd ndc-postgres && git rev-parse HEAD)"
# get short sha too for title
LATEST_SHORT_SHA="$(cd ndc-postgres && git rev-parse --short HEAD)"
BRANCH_NAME="update-ndc-postgres-to-$LATEST_SHA"
DEP_FILEPATH="Cargo.toml"
# Change working directory to the target folder
cd ndc-postgres-multitenant
git config --global user.name "hasura-bot"
git config --global user.email "[email protected]"
# Create a new feature branch for the changes.
git checkout -b $BRANCH_NAME
# there will be multiple `ndc-postgres` deps, so we target a specific
# one, presumably the latest version. This will need updating as we
# add new `ndc-postgres` versions into `ndc-postgres-multitenant`
LATEST_NDC_POSTGRES_VERSION="1"
# Update the hash for ndc-postgres
sed -i -e "/ndc-postgres_v${LATEST_NDC_POSTGRES_VERSION}/s/rev[ ]*=[ ]*\"[[:alnum:]]*\"/rev = \"$LATEST_SHA\"/g" $DEP_FILEPATH
# Update the hash for ndc-postgres-configuration
sed -i -e "/ndc-postgres-configuration_v${LATEST_NDC_POSTGRES_VERSION}/s/rev[ ]*=[ ]*\"[[:alnum:]]*\"/rev = \"$LATEST_SHA\"/g" $DEP_FILEPATH
# ssh git access required for cargo update
eval "$(ssh-agent -s)"
ssh-add - <<< '${{ secrets.SSH_GIT_ACCESS_PRIVATE }}'
# Update Cargo lock file, but as little as possible
cargo update -p ndc-postgres@${LATEST_NDC_POSTGRES_VERSION}
# Commit the changes and push the feature branch to origin
git add .
git commit -m "dep update: update ndc-postgres to $LATEST_SHA"
git push origin $BRANCH_NAME
# create a pull-requests containing the updates.
gh pr create \
--body "Commit in ndc-postgres: https://github.com/hasura/ndc-postgres/commit/$LATEST_SHA" \
--title "dep update: update ndc-postgres to $LATEST_SHORT_SHA" \
--head "$BRANCH_NAME" \
--base "main" \
--reviewer "hasura/engine"
# scream into Slack if something goes wrong
- name: Report Status
if: always()
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
notify_when: failure
notification_title: "😧 Error on <{repo_url}|{repo}>"
message_format: "🐴 *{workflow}* {status_message} for <{repo_url}|{repo}>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.BROKEN_BUILD_SLACK_WEBHOOK_URL }}