Skip to content

Commit

Permalink
build: Better error checking in changeversion, fix missing hash outpu…
Browse files Browse the repository at this point in the history
…ts in CI (#2041)
  • Loading branch information
trisyoungs authored Jan 21, 2025
1 parent 7fc9f83 commit 77059ed
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/_checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ jobs:
ANTLR_VERSION=$(cat ${{ inputs.conanfile }} | sed -n -e 's%^.*antlr4-cppruntime/%%p')
echo "antlrVersion=${ANTLR_VERSION}" >> $GITHUB_OUTPUT
- name: Get nix hash
- name: Get Hashes
id: hashes
shell: bash
run: |
set -ex
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ jobs:
shell: bash
run: |
echo "Publishing to Harbor, tagged as [${{ inputs.publishType }}]..."
apptainer remote login --username ${HARBOR_USER} --password ${HARBOR_SECRET} docker://harbor.stfc.ac.uk
apptainer remote login --username ${{ secrets.HARBOR_USER }} --password ${{ secrets.HARBOR_SECRET }} docker://harbor.stfc.ac.uk
apptainer push packages/dissolve-gui-${{ inputs.currentVersion }}.sif oras://harbor.stfc.ac.uk/isis_disordered_materials/dissolve:${{ inputs.publishType }}
20 changes: 10 additions & 10 deletions .github/workflows/_website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,29 +156,29 @@ jobs:
if: ${{ inputs.publishType == 'release' }}
shell: bash
run: |
echo "${SERVER_ID}" > ./serverId
echo "${SERVER_KEY}" > ./serverKey
echo "${{ secrets.SERVER_ID }}" > ./serverId
echo "${{ secrets.SERVER_KEY }}" > ./serverKey
chmod 0600 ./serverKey ./serverId
rsync -avz --delete -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${SERVER_PORT} -l ${SERVER_USER}" web/public/ ${SERVER_IP}:${SERVER_MAIN_DIR}
rsync -avz --delete --exclude=dev --exclude=legacy -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${SERVER_PORT} -l ${SERVER_USER}" web/public-docs/ ${SERVER_IP}:${SERVER_DOCS_DIR}
rsync -avz --delete -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${{ secrets.SERVER_PORT }} -l ${{ secrets.SERVER_USER }}" web/public/ ${{ secrets.SERVER_IP }}:${{ secrets.SERVER_MAIN_DIR }}
rsync -avz --delete --exclude=dev --exclude=legacy -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${{ secrets.SERVER_PORT }} -l ${{ secrets.SERVER_USER }}" web/public-docs/ ${{ secrets.SERVER_IP }}:${{ secrets.SERVER_DOCS_DIR }}
- name: 'SSH Deploy to Server (Legacy) (Docs only)'
if: ${{ inputs.publishType == 'legacy' }}
shell: bash
run: |
echo "${SERVER_ID}" > ./serverId
echo "${SERVER_KEY}" > ./serverKey
echo "${{ secrets.SERVER_ID }}" > ./serverId
echo "${{ secrets.SERVER_KEY }}" > ./serverKey
chmod 0600 ./serverKey ./serverId
rsync -avz --delete -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${SERVER_PORT} -l ${SERVER_USER}" web/public-docs/ ${SERVER_IP}:${SERVER_DOCS_DIR}/legacy
rsync -avz --delete -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${{ secrets.SERVER_PORT }} -l ${{ secrets.SERVER_USER }}" web/public-docs/ ${{ secrets.SERVER_IP }}:${{ secrets.SERVER_DOCS_DIR }}/legacy
- name: 'SSH Deploy to Server (Continuous) (Docs only)'
if: ${{ inputs.publishType == 'continuous' }}
shell: bash
run: |
echo "${SERVER_ID}" > ./serverId
echo "${SERVER_KEY}" > ./serverKey
echo "${{ secrets.SERVER_ID }}" > ./serverId
echo "${{ secrets.SERVER_KEY }}" > ./serverKey
chmod 0600 ./serverKey ./serverId
rsync -avz --delete -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${SERVER_PORT} -l ${SERVER_USER}" web/public-docs/ ${SERVER_IP}:${SERVER_DOCS_DIR}/dev
rsync -avz --delete -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${{ secrets.SERVER_PORT }} -l ${{ secrets.SERVER_USER }}" web/public-docs/ ${{ secrets.SERVER_IP }}:${{ secrets.SERVER_DOCS_DIR }}/dev
- name: Upload Web Artifacts
uses: actions/upload-artifact@v4
Expand Down
19 changes: 11 additions & 8 deletions changeversion
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ GetCodeVersion() {
MAIN_VERSION=$(grep '#define DISSOLVEVERSION' src/main/version.cpp | sed -e 's/#define DISSOLVEVERSION "\([0-9a-z\.]\+\).*"/\1/g')
echo " version.cpp : ${MAIN_VERSION}"

if [[ ! "${MAIN_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "!!! Malformed version (or no version at all) found in version.cpp."
return 1
fi

# Flake (flake.nix)
FLAKE_VERSION=$(grep " version =" flake.nix | sed -e "s/\W*version = \"\(.*\)\";/\1/")
echo " flake.nix : ${FLAKE_VERSION}"
Expand Down Expand Up @@ -83,14 +88,6 @@ GetCodeVersion() {
return 0
}

# Windows build files
# sed -i -e "s/#define MyAppVersion \"[0-9\.]*\"/#define MyAppVersion \"$MAJOR.$MINOR.$PATCH\"/g" -e "s/OutputBaseFilename=Dissolve-GUI-[0-9\.]*-Win64/OutputBaseFilename=Dissolve-GUI-$MAJOR.$MINOR.$PATCH-Win64/g" ci/windows/dissolve-gui.iss
# echo -n " dissolve-gui.iss (Program Version) : "
# grep 'define MyAppVersion' ci/windows/dissolve-gui.iss | sed -e 's/#define MyAppVersion \"\([0-9\.]*\)\"/\1/g'
# echo -n " dissolve-gui.iss (Output Filename) : "
# grep 'OutputBaseFilename' ci/windows/dissolve-gui.iss | sed -e 's/OutputBaseFilename=Dissolve-GUI-\([0-9\.]*\)-Win64/\1/g'


# Set web release version and date
SetWebReleaseInfo() {
# Must have new version string as argument
Expand All @@ -117,6 +114,12 @@ GetWebReleaseInfo() {
echo " main.toml (Version) : ${WEB_VERSION}"
echo " main.toml (Date) : ${WEB_DATE}"

# Did we get a sensible version out of the file?
if [[ ! "${WEB_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "!!! Malformed version (or no version at all) found in main.toml."
return 1
fi

# Check Version?
if [ $# == 1 ] && [ ${WEB_VERSION} != "$1" ]
then
Expand Down

0 comments on commit 77059ed

Please sign in to comment.