Update github-actions-builddockerfile.yml

This commit is contained in:
McCloudS
2024-03-04 06:42:47 -07:00
committed by GitHub
parent 8b988f976a
commit f2b4710ea9

View File

@@ -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