diff --git a/.github/actions/save_git_info/action.yml b/.github/actions/save_git_info/action.yml new file mode 100644 index 00000000000..695a64d80ec --- /dev/null +++ b/.github/actions/save_git_info/action.yml @@ -0,0 +1,12 @@ +name: save_git_info +description: Save GIT info for builds + +runs: + using: 'composite' + steps: + - name: Save Git info + shell: bash + run: | + git describe --tags | python -c "import sys; print(next(sys.stdin).lstrip('v'))" > .TriblerVersion + git rev-parse HEAD > .TriblerCommit + echo "TRIBLER_VERSION=$(head -n 1 .TriblerVersion)" >> $GITHUB_ENV diff --git a/.github/workflows/build_mac.yml b/.github/workflows/build_mac.yml index cbc84d068c7..14d51f9fb38 100644 --- a/.github/workflows/build_mac.yml +++ b/.github/workflows/build_mac.yml @@ -51,11 +51,7 @@ jobs: with: python-version: ${{ github.event.inputs.python-version || inputs.python-version }} - - name: Save Git info - run: | - git describe | python -c "import sys; print(next(sys.stdin).lstrip('v'))" > .TriblerVersion - git rev-parse HEAD > .TriblerCommit - echo "TRIBLER_VERSION=$(head -n 1 .TriblerVersion)" >> $GITHUB_ENV + - uses: ./.github/actions/save_git_info - name: Prepare files env: diff --git a/.github/workflows/build_ubuntu.yml b/.github/workflows/build_ubuntu.yml index 6357b1561f0..107efeb7a89 100644 --- a/.github/workflows/build_ubuntu.yml +++ b/.github/workflows/build_ubuntu.yml @@ -57,11 +57,7 @@ jobs: python-version: ${{ github.event.inputs.python-version || inputs.python-version }} requirements: requirements-build.txt - - name: Save Git info - run: | - git describe | python -c "import sys; print(next(sys.stdin).lstrip('v'))" > .TriblerVersion - git rev-parse HEAD > .TriblerCommit - echo "TRIBLER_VERSION=$(head -n 1 .TriblerVersion)" >> $GITHUB_ENV + - uses: ./.github/actions/save_git_info - name: Install Ubuntu dependencies run: | diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 4931c50841c..cf87998d3b2 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -57,10 +57,7 @@ jobs: with: python-version: ${{ github.event.inputs.python-version || inputs.python-version }} - - name: Save Git info - run: | - git describe | python -c "import sys; print(next(sys.stdin).lstrip('v'))" > .TriblerVersion - git rev-parse HEAD > .TriblerCommit + - uses: ./.github/actions/save_git_info - name: Install windows dependencies uses: ./.github/actions/windows_dependencies