Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Woazboat
flow3r firmware
Commits
1efb39f5
Commit
1efb39f5
authored
1 year ago
by
q3k
Browse files
Options
Downloads
Patches
Plain Diff
st3m: make version.py aware of CI
parent
5ab461c2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/st3m/host-tools/version.py
+11
-2
11 additions, 2 deletions
components/st3m/host-tools/version.py
tools/dist.sh
+5
-14
5 additions, 14 deletions
tools/dist.sh
with
16 additions
and
16 deletions
components/st3m/host-tools/version.py
+
11
−
2
View file @
1efb39f5
...
...
@@ -10,6 +10,7 @@ and the release process.
import
subprocess
import
sys
import
os
class
Tag
:
...
...
@@ -50,7 +51,7 @@ def tags_for_commit(release, commit):
return
res
def
get_version
():
def
get_
git_based_
version
():
commit
=
subprocess
.
check_output
([
"
git
"
,
"
rev-parse
"
,
"
HEAD
"
]).
decode
().
strip
()
branches
=
(
subprocess
.
check_output
(
...
...
@@ -118,7 +119,15 @@ if len(sys.argv) > 1:
if
sys
.
argv
[
1
]
==
"
-c
"
:
fmt
=
"
C
"
v
=
get_version
()
v
=
None
if
os
.
environ
.
get
(
'
CI
'
)
is
not
None
:
tag
=
os
.
environ
.
get
(
'
CI_COMMIT_TAG
'
)
if
tag
is
not
None
:
# If we're building a tag, just use that as a version.
v
=
tag
if
v
is
None
:
v
=
get_git_based_version
()
if
fmt
==
"
C
"
:
print
(
'
const char *st3m_version =
"'
+
v
+
'"
;
'
)
else
:
...
...
This diff is collapsed.
Click to expand it.
tools/dist.sh
+
5
−
14
View file @
1efb39f5
...
...
@@ -11,21 +11,12 @@ if [ ! -f sdkconfig.defaults ] || [ ! -f recovery/sdkconfig.defaults ]; then
exit
1
fi
if
[
!
-z
"
${
CI
}
"
]
;
then
if
[
!
-z
"
${
CI_COMMIT_TAG
}
"
]
;
then
# If we're building a tag, just use that as a version.
version
=
"
${
CI_COMMIT_TAG
}
"
else
# Otherwise, let normal version machinery run, but fetch all changes
# and check out the correct branch. Otherwise we'll get weird version
# strings.
git fetch
--unshallow
origin
"
$CI_COMMIT_REF_NAME
"
git checkout
"
$CI_COMMIT_REF_NAME
"
version
=
"
$(
python3 components/st3m/host-tools/version.py
)
"
fi
else
version
=
"
$(
python3 components/st3m/host-tools/version.py
)
"
# Always fetch full history on Gitlab when not building a tag, otherwise we get bogus results.
if
[
!
-z
"
${
CI
}
"
&&
-z
"
${
CI_COMMIT_TAG
}
"
]
;
then
git fetch
--unshallow
origin
"
$CI_COMMIT_REF_NAME
"
git checkout
"
$CI_COMMIT_REF_NAME
"
fi
version
=
"
$(
python3 components/st3m/host-tools/version.py
)
"
rm
-rf
sdkconfig build
rm
-rf
recovery/sdkconfig recovery/build
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment