CI: Use commit date as the Rolling version number

The Rolling version number was previously set as the result of a
`date` command, implicitly using server time (as of the time the CI
build was running, in the time zone of the server), meaning the
version number could be different based on server timezone across many
regions the CI could happen to run in, based on the timing of re-runs,
or change due to slight differences in how runners were allocated to
run each job.

Most notably, this could lead to the different OS/arch builds having
different version numbers from the same overall CI build, since they
ran in separate tasks!

Now that we have multiple CI providers building the editor binaries,
we have rather drastically different timing of these runs, and the
version numbers are likely never going to sync up.

---

By setting the version number from the commit date, always in UTC,
Rolling versions on Cirrus should now always sync up
with an existing version as published from GitHub Actions.

This also means we can check the commit dates of recent commits to
`master` branch in order to know which exact commit a given Rolling
release version corresponds to.

---

This idea was worked on by a few people, and also thanks to this
StackOverflow answer:
https://stackoverflow.com/questions/21363187/git-show-dates-in-utc

Co-authored-by: Meadowsys <blazeykirin@gmail.com>
Co-authored-by: confused-Techie <dev@lhbasics.com>
This commit is contained in:
DeeDeeG 2023-09-14 00:50:13 -04:00
parent 80e830b573
commit 06afb505d9
2 changed files with 15 additions and 12 deletions

View File

@ -28,7 +28,8 @@ env:
# xvfb
# - git submodule init
# - git submodule update
# - sed -i -e "s/[0-9]*-dev/`date -u +%Y%m%d%H`/g" package.json
# - export COMMIT_DATE=`TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H' --format="%cd"`
# - sed -i -e "s/[0-9]*-dev/${COMMIT_DATE}/g" package.json
# install_script:
# - yarn install --ignore-engines || yarn install --ignore-engines
# build_script:
@ -88,7 +89,8 @@ arm_linux_task:
- gem install fpm
- git submodule init
- git submodule update
- sed -i -e "s/[0-9]*-dev/`date -u +%Y%m%d%H`/g" package.json
- export COMMIT_DATE=`TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H' --format="%cd"`
- sed -i -e "s/[0-9]*-dev/${COMMIT_DATE}/g" package.json
install_script:
- yarn install --ignore-engines || yarn install --ignore-engines
build_script:
@ -137,7 +139,8 @@ silicon_mac_task:
- git submodule update
- ln -s /opt/homebrew/bin/python$PYTHON_VERSION /opt/homebrew/bin/python
- export PATH="/opt/homebrew/bin:/opt/homebrew/opt/node@16/bin:$PATH"
- sed -i -e "s/[0-9]*-dev/`date -u +%Y%m%d%H`/g" package.json
- export COMMIT_DATE=`TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H' --format="%cd"`
- sed -i -e "s/[0-9]*-dev/${COMMIT_DATE}/g" package.json
install_script:
- export PATH="/opt/homebrew/bin:/opt/homebrew/opt/node@16/bin:$PATH"
- yarn install --ignore-engines || yarn install --ignore-engines
@ -193,7 +196,8 @@ silicon_mac_task:
# - ln -s /usr/local/bin/python$PYTHON_VERSION /usr/local/bin/python
# - git submodule init
# - git submodule update
# - sed -i -e "s/[0-9]*-dev/`date -u +%Y%m%d%H`/g" package.json
# - export COMMIT_DATE=`TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H' --format="%cd"`
# - sed -i -e "s/[0-9]*-dev/${COMMIT_DATE}/g" package.json
# install_script:
# - export PATH="/usr/local/opt/node@16/bin:/usr/local/bin:$PATH"
# - arch -x86_64 npx yarn install --ignore-engines || arch -x86_64 npx yarn install --ignore-engines
@ -246,7 +250,8 @@ silicon_mac_task:
# - npx yarn build:apm
# - npx yarn build || npx yarn build || npx yarn build
# build_binary_script:
# - sed -i -e "s/[0-9]*-dev/`date -u +%Y%m%d%H`/g" package.json
# - export COMMIT_DATE=`TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H' --format="%cd"`
# - sed -i -e "s/[0-9]*-dev/${COMMIT_DATE}/g" package.json
# - npx yarn dist || npx yarn dist || npx yarn dist
# rename_binary_script:
# - node script/rename.js "Windows"

View File

@ -45,13 +45,11 @@ jobs:
git submodule init
git submodule update
- name: Check Pulsar Version
if: ${{ runner.os != 'Windows' }}
run: sed -i -e "s/[0-9]*-dev/`date -u +%Y%m%d%H`/g" package.json
- name: Check Pulsar Version - Windows
if: ${{ runner.os == 'Windows' }}
run: (Get-Content package.json) -replace '[0-9]*-dev', (date -u +%Y%m%d%H) | Set-Content -Path package.json
- name: Update Pulsar version number for Rolling
run: |
export COMMIT_DATE=`TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H' --format="%cd"`
sed -i -e "s/[0-9]*-dev/${COMMIT_DATE}/g" package.json
shell: bash
- name: Install Pulsar Dependencies
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd