Skip to content

Commit cf4f7d1

Browse files
committed
Fix for failing to check out the latest tag
1 parent 09eb1bf commit cf4f7d1

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/build-push-apptainer.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,28 @@ jobs:
2121
- name: Check out the repository
2222
uses: actions/checkout@v4
2323

24+
- name: Install git
25+
run: |
26+
apk update
27+
apk add --no-cache git
28+
git config --global --add safe.directory "$GITHUB_WORKSPACE" # Ensure the workspace is safe
29+
git --version # Verify that Git is installed successfully
30+
2431
- name: Verify Git repository and working directory
2532
run: |
2633
echo "Current directory: $(pwd)"
2734
echo "Listing contents:"
2835
ls -la # List contents to see if the repository exists
36+
git --version # Check that git is accessible
2937
git status # Verify that Git can see the repo
3038
31-
- name: Install git
32-
run: |
33-
apk update
34-
apk add git
35-
git config --global --add safe.directory "$GITHUB_WORKSPACE" # Ensure the workspace is safe
36-
3739
- name: Get latest tag
3840
id: tag
3941
run: |
40-
cd "$GITHUB_WORKSPACE" # Explicitly set the correct directory
42+
cd "$GITHUB_WORKSPACE" # Explicitly set the correct directory
4143
echo "Current directory: $(pwd)" # Debug: Check if we're in the correct directory
42-
ls -la # List contents again to ensure we're in the right repo
43-
git status # Verify Git is working inside the container
44+
ls -la # List contents again to ensure we're in the right repo
45+
git status # Verify Git is working inside the container
4446
git fetch --tags
4547
if ! LATEST_TAG=$(git describe --tags --abbrev=0); then
4648
echo "::error::No tags found in repository"

0 commit comments

Comments
 (0)