Skip to content

Commit 1622681

Browse files
committed
123
1 parent d2eba37 commit 1622681

File tree

1 file changed

+21
-110
lines changed

1 file changed

+21
-110
lines changed

.github/workflows/update-version-file-on-release.yml

Lines changed: 21 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,27 @@ jobs:
1515
uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
18-
submodules: "recursive"
18+
# submodules: "recursive"
19+
20+
- name: Safe submodule initialization
21+
run: |
22+
echo "Checking for submodules..."
23+
if [ -f .gitmodules ]; then
24+
if [ -s .gitmodules ]; then
25+
echo "Initializing submodules..."
26+
if git submodule sync --recursive 2>/dev/null; then
27+
git submodule update --init --force --recursive || {
28+
echo "Warning: Some submodules failed to initialize, continuing anyway..."
29+
}
30+
else
31+
echo "Warning: Submodule sync failed, continuing without submodules..."
32+
fi
33+
else
34+
echo ".gitmodules exists but is empty, skipping submodule initialization"
35+
fi
36+
else
37+
echo "No .gitmodules file found, no submodules to initialize"
38+
fi
1939
2040
# Step 2: Set up Git with official account
2141
- name: Set up Git
@@ -97,112 +117,3 @@ jobs:
97117
} catch (error) {
98118
core.warning(`Could not find or update release for tag ${tagName}: ${error.message}`);
99119
}
100-
101-
# # Step 8: Create custom source code packages
102-
# - name: Create custom source code packages
103-
# run: |
104-
# PROJECT_NAME="${{ github.event.repository.name }}"
105-
# echo "Project name: $PROJECT_NAME"
106-
# echo "Tag version: ${{ env.TAG_VERSION }}"
107-
108-
# CURRENT_BRANCH=""
109-
110-
# if [ ! -z "${{ github.event.release.target_commitish }}" ]; then
111-
# CURRENT_BRANCH="${{ github.event.release.target_commitish }}"
112-
# echo "Branch from release target_commitish: $CURRENT_BRANCH"
113-
# fi
114-
115-
# if [ -z "$CURRENT_BRANCH" ]; then
116-
# CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "main")
117-
# echo "Branch from git HEAD: $CURRENT_BRANCH"
118-
# fi
119-
120-
# echo "Final branch to use: $CURRENT_BRANCH"
121-
122-
# mkdir -p temp-package
123-
124-
# echo "Attempting to clone from remote repository..."
125-
# REPO_URL="https://github.com/${{ github.repository }}.git"
126-
127-
# if git clone --single-branch --branch "$CURRENT_BRANCH" --no-tags "$REPO_URL" temp-package/$PROJECT_NAME-${{ env.TAG_VERSION }} 2>/dev/null; then
128-
# echo "Successfully cloned branch $CURRENT_BRANCH from remote"
129-
# else
130-
# echo "Failed to clone from remote, trying local methods..."
131-
132-
# mkdir -p temp-package/$PROJECT_NAME-${{ env.TAG_VERSION }}
133-
# rsync -av --exclude='.git' --exclude='temp-package' . temp-package/$PROJECT_NAME-${{ env.TAG_VERSION }}/
134-
135-
# cd temp-package/$PROJECT_NAME-${{ env.TAG_VERSION }}
136-
# git init
137-
# # git config user.name "github-actions[bot]"
138-
# # git config user.email "github-actions[bot]@users.noreply.github.com"
139-
140-
# # git remote add origin "$REPO_URL"
141-
142-
# echo "Fetching branch history..."
143-
# if git fetch origin "$CURRENT_BRANCH" 2>/dev/null; then
144-
# echo "Successfully fetched $CURRENT_BRANCH history"
145-
# git reset --hard "origin/$CURRENT_BRANCH"
146-
# git checkout -b "$CURRENT_BRANCH"
147-
# else
148-
# echo "Could not fetch remote history, creating new history"
149-
# git add .
150-
# git commit -m "Source code for release ${{ env.TAG_VERSION }}"
151-
# git checkout -b "$CURRENT_BRANCH"
152-
# fi
153-
154-
# cd ../..
155-
# fi
156-
157-
# cd temp-package/$PROJECT_NAME-${{ env.TAG_VERSION }}
158-
159-
# mkdir -p version
160-
161-
# echo -n "${{ env.TAG_VERSION }}" > version/version
162-
163-
# echo "Version file content after update:"
164-
# cat version/version
165-
166-
# git config user.name "github-actions[bot]"
167-
# git config user.email "github-actions[bot]@users.noreply.github.com"
168-
169-
# git add .
170-
# git commit -m "Update version to ${{ env.TAG_VERSION }}"
171-
172-
# echo "Removing all remotes..."
173-
# git remote | xargs -r git remote remove
174-
175-
# echo "Final git status in package:"
176-
# git branch -a 2>/dev/null || echo "No git branches found"
177-
# git log --oneline -5 2>/dev/null || echo "No git history found"
178-
# git remote -v 2>/dev/null || echo "No remotes found"
179-
180-
# cd ..
181-
182-
# zip -r ../$PROJECT_NAME-${{ env.TAG_VERSION }}-with-git.zip $PROJECT_NAME-${{ env.TAG_VERSION }}/
183-
184-
# tar -czf ../$PROJECT_NAME-${{ env.TAG_VERSION }}-with-git.tar.gz $PROJECT_NAME-${{ env.TAG_VERSION }}/
185-
186-
# cd ..
187-
188-
# echo "Created files:"
189-
# ls -la $PROJECT_NAME-${{ env.TAG_VERSION }}-with-git.*
190-
# echo "File sizes:"
191-
# du -h $PROJECT_NAME-${{ env.TAG_VERSION }}-with-git.*
192-
193-
# echo "ZIP contents (first 20 lines):"
194-
# unzip -l $PROJECT_NAME-${{ env.TAG_VERSION }}.zip | head -20
195-
# echo "TAR.GZ contents (first 20 lines):"
196-
# tar -tzf $PROJECT_NAME-${{ env.TAG_VERSION }}.tar.gz | head -20
197-
198-
# - name: Upload custom source packages to existing release
199-
# uses: softprops/action-gh-release@v2
200-
# with:
201-
# tag_name: ${{ env.TAG_VERSION }}
202-
# files: |
203-
# ${{ github.event.repository.name }}-${{ env.TAG_VERSION }}-with-git.zip
204-
# ${{ github.event.repository.name }}-${{ env.TAG_VERSION }}-with-git.tar.gz
205-
# append_body: true
206-
# fail_on_unmatched_files: true
207-
# env:
208-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)