Skip to content

Commit efc20c3

Browse files
fix: Version numbers & assets not uploading
- Refactored version retrieval to fetch all tags using `git fetch --tags --force`. - Modified version extraction to find the latest tag across all branches using `git tag -l | grep "^v[0-9]" | sort -V | tail -n 1`. - Added logging for latest tag found and new version to be created. - Added fetch-tags: true to `actions/checkout@v4`. - Added a step to list downloaded artifacts in the artifacts directory.
1 parent a2ce535 commit efc20c3

1 file changed

Lines changed: 38 additions & 5 deletions

File tree

.github/workflows/main.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ jobs:
1616
- uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
19+
fetch-tags: true
1920

2021
- name: Get latest release version
2122
id: get_version
2223
run: |
23-
# Get the latest tag or set to 0 if none exists
24-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
24+
# Fetch all tags to make sure we have the complete history
25+
git fetch --tags --force
26+
# Get the latest tag across all branches
27+
LATEST_TAG=$(git tag -l | grep "^v[0-9]" | sort -V | tail -n 1 || echo "v1.0.0")
28+
echo "Latest tag found: $LATEST_TAG"
2529
# Extract the version number (remove 'v' prefix)
2630
LATEST_VERSION=${LATEST_TAG#v}
2731
# Parse the version components
@@ -32,6 +36,7 @@ jobs:
3236
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
3337
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
3438
echo "TAG=v$NEW_VERSION" >> $GITHUB_ENV
39+
echo "New version will be: v$NEW_VERSION"
3540
3641
- uses: actions/setup-java@v4
3742
with:
@@ -101,17 +106,27 @@ jobs:
101106
- uses: actions/checkout@v4
102107
with:
103108
fetch-depth: 0
109+
fetch-tags: true
104110

105111
- name: Get latest release version
106112
id: get_version
107113
run: |
108-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
114+
# Fetch all tags to make sure we have the complete history
115+
git fetch --tags --force
116+
# Get the latest tag across all branches
117+
LATEST_TAG=$(git tag -l | grep "^v[0-9]" | sort -V | tail -n 1 || echo "v1.0.0")
118+
echo "Latest tag found: $LATEST_TAG"
119+
# Extract the version number (remove 'v' prefix)
109120
LATEST_VERSION=${LATEST_TAG#v}
121+
# Parse the version components
110122
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_VERSION"
123+
# Increment the patch version
111124
NEW_PATCH=$((PATCH + 1))
125+
# Set the new version
112126
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
113127
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
114128
echo "TAG=v$NEW_VERSION" >> $GITHUB_ENV
129+
echo "New version will be: v$NEW_VERSION"
115130
116131
- uses: subosito/flutter-action@v2
117132
with:
@@ -138,17 +153,29 @@ jobs:
138153
runs-on: ubuntu-latest
139154
steps:
140155
- uses: actions/checkout@v4
156+
with:
157+
fetch-depth: 0
158+
fetch-tags: true
141159

142-
- name: Get version from build
160+
- name: Get latest release version
143161
id: get_version
144162
run: |
145-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v1.0.0")
163+
# Fetch all tags to make sure we have the complete history
164+
git fetch --tags --force
165+
# Get the latest tag across all branches
166+
LATEST_TAG=$(git tag -l | grep "^v[0-9]" | sort -V | tail -n 1 || echo "v1.0.0")
167+
echo "Latest tag found: $LATEST_TAG"
168+
# Extract the version number (remove 'v' prefix)
146169
LATEST_VERSION=${LATEST_TAG#v}
170+
# Parse the version components
147171
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_VERSION"
172+
# Increment the patch version
148173
NEW_PATCH=$((PATCH + 1))
174+
# Set the new version
149175
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
150176
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
151177
echo "TAG=v$NEW_VERSION" >> $GITHUB_ENV
178+
echo "New version will be: v$NEW_VERSION"
152179
153180
- name: Download Android Builds
154181
uses: actions/download-artifact@v4
@@ -162,6 +189,12 @@ jobs:
162189
name: ios-build
163190
path: artifacts
164191

192+
- name: List downloaded artifacts
193+
run: |
194+
echo "Contents of artifacts directory:"
195+
ls -la artifacts/
196+
echo "Preparing to release version: ${{ env.VERSION }}"
197+
165198
- name: Push to Releases
166199
uses: ncipollo/release-action@v1
167200
with:

0 commit comments

Comments
 (0)