name: Build_Subgen_Dockerfile on: push: branches: - 'main' paths-ignore: - '**.md' - '**.yml' workflow_dispatch: jobs: docker: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 with: fetch-depth: 0 - uses: paulhatch/semantic-version@v5.3.0 with: # The prefix to use to identify tags tag_prefix: "v" # A string which, if present in a git commit, indicates that a change represents a # major (breaking) change, supports regular expressions wrapped with '/' major_pattern: "(MAJOR)" # A string which indicates the flags used by the `major_pattern` regular expression. Supported flags: idgs major_regexp_flags: "" # Same as above except indicating a minor change, supports regular expressions wrapped with '/' minor_pattern: "(MINOR)" # A string which indicates the flags used by the `minor_pattern` regular expression. Supported flags: idgs minor_regexp_flags: "" # A string to determine the format of the version output version_format: "${increment}" # If this is set to true, *every* commit will be treated as a new version. bump_each_commit: true - name: Update version file run: | sed -i 's/subgen_version =.*/subgen_version = ${{ steps.semantic-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 subgen/subgen.py git commit -m "Automated update subgen.py with version" git push - name: Login to Docker Hub uses: docker/login-action@v3.0.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v5 with: push: true tags: mccloud/subgen:latest