Skip to content

Commit

Permalink
Add git hash to version for master builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Donkie committed Sep 16, 2023
1 parent af54f07 commit af1f3b4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Add git hash to version
if: github.ref == 'refs/heads/master'
run: |
current_version=$(grep -m 1 -oP 'version = "\K[^"]+' pyproject.toml)
latest_commit_hash=$(git rev-parse --short HEAD)
new_version="${current_version}+${latest_commit_hash}"
sed -i 's/version = \"${current_version}\"/version = \"${new_version}\"/' pyproject.toml
echo "Set project to version ${new_version}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand Down Expand Up @@ -163,6 +172,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Add git hash to version
if: github.ref == 'refs/heads/master'
run: |
current_version=$(grep -m 1 -oP 'version = "\K[^"]+' pyproject.toml)
latest_commit_hash=$(git rev-parse --short HEAD)
new_version="${current_version}+${latest_commit_hash}"
sed -i 's/version = \"${current_version}\"/version = \"${new_version}\"/' pyproject.toml
echo "Set project to version ${new_version}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand Down Expand Up @@ -195,6 +213,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Add git hash to version
if: github.ref == 'refs/heads/master'
run: |
current_version=$(grep -m 1 -oP 'version = "\K[^"]+' pyproject.toml)
latest_commit_hash=$(git rev-parse --short HEAD)
new_version="${current_version}+${latest_commit_hash}"
sed -i 's/version = \"${current_version}\"/version = \"${new_version}\"/' pyproject.toml
echo "Set project to version ${new_version}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand Down Expand Up @@ -227,6 +254,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Add git hash to version
if: github.ref == 'refs/heads/master'
run: |
current_version=$(grep -m 1 -oP 'version = "\K[^"]+' pyproject.toml)
latest_commit_hash=$(git rev-parse --short HEAD)
new_version="${current_version}+${latest_commit_hash}"
sed -i 's/version = \"${current_version}\"/version = \"${new_version}\"/' pyproject.toml
echo "Set project to version ${new_version}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand Down

0 comments on commit af1f3b4

Please sign in to comment.