From 81ac38ec4ef783af76286a0296bcf1724a7e3e73 Mon Sep 17 00:00:00 2001 From: McCloudS <64094529+McCloudS@users.noreply.github.com> Date: Mon, 4 Mar 2024 06:11:01 -0700 Subject: [PATCH] Update github-actions-builddockerfile.yml --- .../github-actions-builddockerfile.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/github-actions-builddockerfile.yml b/.github/workflows/github-actions-builddockerfile.yml index ffcdab2..17f92f2 100644 --- a/.github/workflows/github-actions-builddockerfile.yml +++ b/.github/workflows/github-actions-builddockerfile.yml @@ -10,6 +10,34 @@ on: workflow_dispatch: jobs: + update_version: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Extract commit version and date + run: | + export COMMIT_VERSION=$(git describe --tags --abbrev=0) + export COMMIT_DATE=$(git log -1 --format=%cd --date=format:'%Y-%m-%d') + echo "Commit Version: $COMMIT_VERSION" + echo "Commit Date: $COMMIT_DATE" + echo "::set-env name=COMMIT_VERSION::$COMMIT_VERSION" + echo "::set-env name=COMMIT_DATE::$COMMIT_DATE" + + - name: Update Python file + run: | + sed -i "s/\$COMMIT_VERSION/${COMMIT_VERSION}/g" subgen/subgen.py + sed -i "s/\$COMMIT_DATE/${COMMIT_DATE}/g" subgen/subgen.py + + - name: Commit and push changes + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git add version.py + git commit -m "Update subgen.py with commit version and date" + git push docker: runs-on: ubuntu-latest steps: