From f2b4710ea91d13785ee53ac22852f88423845b80 Mon Sep 17 00:00:00 2001 From: McCloudS <64094529+McCloudS@users.noreply.github.com> Date: Mon, 4 Mar 2024 06:42:47 -0700 Subject: [PATCH] Update github-actions-builddockerfile.yml --- .../github-actions-builddockerfile.yml | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/github-actions-builddockerfile.yml b/.github/workflows/github-actions-builddockerfile.yml index 17f92f2..5adab59 100644 --- a/.github/workflows/github-actions-builddockerfile.yml +++ b/.github/workflows/github-actions-builddockerfile.yml @@ -10,37 +10,27 @@ on: workflow_dispatch: jobs: - update_version: + + docker: runs-on: ubuntu-latest - steps: + - name: Get next version + uses: reecetech/version-increment@2023.10.1 + id: version + with: + scheme: calver - name: Checkout code uses: actions/checkout@v2 - - - name: Extract commit version and date + - name: Update version file 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 - + sed -i 's/subgen_version =.*/subgen_version = ${{ steps.version.outputs.version }}/' 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 add subgen/subgen.py + git commit -m "Automated update subgen.py with version" git push - docker: - runs-on: ubuntu-latest - steps: - name: Login to Docker Hub uses: docker/login-action@v3.0.0