deploy-tools/.github/workflows/cs-update-push.yml
2025-03-04 21:51:34 +05:30

68 lines
2.0 KiB
YAML

name: Update Repo Version Workflow
on:
workflow_call:
secrets:
bot_build_repo_token:
required: true
jobs:
cs-update-push:
runs-on: ubuntu-22.04
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- id: read-issue
name: Read the issue comment
run: |
ISSUE_COMMENT_STRING='${{ github.event.comment.body }}'
DOCKER_BASE=`echo $ISSUE_COMMENT_STRING | jq ".image"`
BUILD_ID=`echo $ISSUE_COMMENT_STRING | jq ".tag"`
echo "DOCKER_BASE=$DOCKER_BASE" >> "$GITHUB_OUTPUT";
echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT";
- name: Print IMAGE and TAG
run: |
echo "BUILD_ID: ${{ steps.read-issue.outputs.BUILD_ID }}";
echo "DOCKER_BASE: ${{ steps.read-issue.outputs.DOCKER_BASE }}";
- name: Checkout cs repo
uses: actions/checkout@v4
with:
path: cs
fetch-depth: 50 #To get the topmost git tags
fetch-tags: true
token: ${{ secrets.bot_build_repo_token }} #This is because we want to trigger a new build
- name: Checkout deploy-tools
uses: actions/checkout@v4
with:
github-server-url: ${{ github.server_url }}
repository: gmetribin/deploy-tools
ref: v1.1.18
path: deploy-tools
# token: $\{{ github.token }} # DEFAULT / Any pushes with github.token don't trigger a chained build
- name: Increment package version and push
run: |
git config --global user.name 'bot-build'
git config --global user.email 'techbots+build@gmetri.com'
BUILD_ID=${{ steps.read-issue.outputs.BUILD_ID }}
DOCKER_BASE=${{ steps.read-issue.outputs.DOCKER_BASE }}
REPOLIST=./.github/repolist.txt
pwd; ls -al;
cd cs;
set -x;
../deploy-tools/src/repo_to_cs.sh -m $DOCKER_BASE -t $BUILD_ID -r $REPOLIST;
git push origin main;
git push --tags origin main;