87 lines
3.1 KiB
YAML
87 lines
3.1 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 }}'
|
|
TAG=`echo $ISSUE_COMMENT_STRING | jq -r ".tag"`
|
|
REPO=`echo $ISSUE_COMMENT_STRING | jq -r ".repo"`
|
|
SENDER=`echo $ISSUE_COMMENT_STRING | jq -r ".sender"`
|
|
|
|
# Try to extract docker_repo from issue comment, fallback to default variable
|
|
DOCKER_REPO_FROM_COMMENT=`echo $ISSUE_COMMENT_STRING | jq -r ".docker_repo"`
|
|
if [ -n "$DOCKER_REPO_FROM_COMMENT" ] && [ "$DOCKER_REPO_FROM_COMMENT" != "null" ]; then
|
|
DOCKER_REPO=$DOCKER_REPO_FROM_COMMENT/$REPO
|
|
echo "Using docker_repo from issue comment: $DOCKER_REPO"
|
|
else
|
|
DOCKER_REPO=${{ vars.docker_repo2_registry }}/$REPO
|
|
echo "Using fallback docker_repo: $DOCKER_REPO"
|
|
fi
|
|
|
|
echo "TAG=$TAG" >> "$GITHUB_OUTPUT";
|
|
echo "REPO=$REPO" >> "$GITHUB_OUTPUT";
|
|
echo "SENDER=$SENDER" >> "$GITHUB_OUTPUT";
|
|
echo "DOCKER_REPO=$DOCKER_REPO" >> "$GITHUB_OUTPUT";
|
|
|
|
- name: Print IMAGE and TAG
|
|
run: |
|
|
echo "TAG: ${{ steps.read-issue.outputs.TAG }}";
|
|
echo "REPO: ${{ steps.read-issue.outputs.REPO }}";
|
|
echo "SENDER: ${{ steps.read-issue.outputs.SENDER }}";
|
|
echo "DOCKER_REPO: ${{ steps.read-issue.outputs.DOCKER_REPO }}";
|
|
|
|
- name: Checkout cs repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ secrets.bot_build_repo_token }} #This is because we want to trigger a new build
|
|
path: cs
|
|
#Temporary problem git#v2.48.0 - tags aren't fetched with --tags. https://github.com/actions/checkout/issues/2041
|
|
#fetch-depth: 50 #To get the topmost git tags
|
|
#fetch-tags: true
|
|
fetch-depth: 0
|
|
|
|
- name: Checkout deploy-tools
|
|
uses: actions/checkout@v4
|
|
with:
|
|
github-server-url: ${{ github.server_url }}
|
|
repository: gmetribin/deploy-tools
|
|
ref: v1.1.42
|
|
path: deploy-tools
|
|
# token: $\{{ github.token }} # DEFAULT / Any pushes with github.token don't trigger a chained build
|
|
|
|
#To fetch tags correctly: https://github.com/actions/checkout/issues/1471#issuecomment-1755560284
|
|
- name: Increment package version and push
|
|
run: |
|
|
git config --global user.name 'bot-build'
|
|
git config --global user.email 'techbots+build@gmetri.com'
|
|
|
|
TAG=${{ steps.read-issue.outputs.TAG }}
|
|
export REPO=${{ steps.read-issue.outputs.REPO }}
|
|
export SENDER=${{ steps.read-issue.outputs.SENDER }}
|
|
DOCKER_REPO=${{ steps.read-issue.outputs.DOCKER_REPO }}
|
|
REPOLIST=./.github/repolist.txt
|
|
pwd; ls -al;
|
|
|
|
cd cs;
|
|
../deploy-tools/src/repo_to_cs.sh -m $DOCKER_REPO -t $TAG -r $REPOLIST;
|
|
|
|
git push origin main;
|
|
git push --tags origin main;
|