Skip to content

Commit

Permalink
Fix obtaining the repo from git when tagged
Browse files Browse the repository at this point in the history
Fetch git tags manually. Becasue of  actions/checkout#1467
  • Loading branch information
Thomas Finnie committed Aug 6, 2024
1 parent dbc2c11 commit 0cfe556
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ jobs:
build-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
- name: Fetch tag annotations
run: |
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
git fetch --force --tags --depth 1
- id: read_tag
name: Set VERSION env variable
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
# Set tag from GitHub: using git describe for tags inside the run script
# seems not working
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
Expand Down
26 changes: 24 additions & 2 deletions .github/workflows/distribute_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,18 @@ jobs:
with:
# We need quite a deep fetch so that we get the versioning right
fetch-depth: 500
fetch-tags: true
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
- name: Fetch tag annotations
run: |
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
git fetch --force --tags --depth 1
- id: read_tag
name: Set VERSION env variable
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
# Set tag from GitHub: using git describe for tags inside the run script
# seems not working
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Install dependencies
run: |
Expand Down Expand Up @@ -109,7 +120,18 @@ jobs:
with:
# We need quite a deep fetch so that we get the versioning right
fetch-depth: 500
fetch-tags: true
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
- name: Fetch tag annotations
run: |
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
git fetch --force --tags --depth 1
- id: read_tag
name: Set VERSION env variable
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
# Set tag from GitHub: using git describe for tags inside the run script
# seems not working
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
# setuptools_scm workaround for https://github.com/pypa/setuptools_scm/issues/455
- name: Disable local version identifier on develop CI
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ jobs:

steps:
- uses: actions/checkout@v4
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
- name: Fetch tag annotations
run: |
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
git fetch --force --tags --depth 1
- id: read_tag
name: Set VERSION env variable
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
# Set tag from GitHub: using git describe for tags inside the run script
# seems not working
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/cache@v4
if: startsWith(runner.os, 'Linux')
Expand Down

0 comments on commit 0cfe556

Please sign in to comment.