added 'Show version' step #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and publish Docker image to Github Container Registry ghcr.io | |
on: | |
push: | |
branches-ignore: | |
- master | |
- version-* | |
- dependabot** | |
paths-ignore: | |
- README.md | |
jobs: | |
get-git-branch: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get branch name | |
id: branch | |
run: echo "branch_name=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
get-commit-hash: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get SHA of the commit | |
id: sha | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
get-version: | |
runs-on: ubuntu-20.04 | |
needs: [ get-git-branch, get-commit-hash ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get package version | |
id: pack_ver | |
uses: notiz-dev/github-action-json-property@release | |
with: | |
path: package_info.json | |
prop_path: package_version | |
- name: Show version | |
run: echo ${{ steps.pack_ver.outputs.prop }} | |
outputs: | |
versionNumber: ${{ steps.pack_ver.outputs.prop }} | |
version: ${{ steps.pack_ver.outputs.prop }}-${{ steps.get-git-branch.outputs.branch_name }}-${{ github.run_id }}-${{ steps.get-commit-hash.outputs.sha_short }} | |
docker-push: | |
runs-on: ubuntu-20.04 | |
name: Build Docker image and push to ghcr.io | |
needs: [ get-version ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: '.' | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.version }} | |
labels: com.exactpro.th2.${{ github.repository }}=${{ steps.get-version.outputs.versionNumber }} | |
provenance: false | |
build-args: | | |
release_version=${{ steps.get-version.outputs.versionNumber }} | |
# uses: th2-net/.github/.github/workflows/compaund-java-docker-push.yml@main | |
# with: | |
# runsOn: ${{ inputs.runsOn }} | |
# version: ${{ needs.prebuild-job.outputs.version }} | |
# versionNumber: ${{ needs.prebuild-job.outputs.versionNumber }} | |
# secrets: | |
# docker-password: ${{ secrets.docker-password }} | |
# | |
# build-job: | |
# uses: th2-net/.github/.github/workflows/compound-java-dev.yml@main | |
# with: | |
# build-target: 'Docker' | |
# docker-username: ${{ github.actor }} | |
# secrets: | |
# docker-password: ${{ secrets.GITHUB_TOKEN }} | |
# nvd-api-key: ${{ secrets.NVD_APIKEY }} | |
scan: | |
name: Vulnerabilities scan | |
uses: th2-net/.github/.github/workflows/python-scan.yml@main |