diff --git a/.github/workflows/_build_and_package.yml b/.github/workflows/_build_and_package.yml index 0eb50e7ff9..fb4c185f4a 100644 --- a/.github/workflows/_build_and_package.yml +++ b/.github/workflows/_build_and_package.yml @@ -3,24 +3,25 @@ name: Build and Package on: workflow_call: inputs: - checkoutRef: - default: '' + currentVersion: type: string + required: true + description: "Version used for labelling packages and other artifacts" + qtVersion: + type: string + required: true + antlrVersion: + type: string + required: true + conanHash: + type: string + required: true + nixHash: + type: string + required: true jobs: - QC: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.checkoutRef }} - - name: Setup - uses: "./.github/workflows/setup" - - name: Quality Control - uses: "./.github/workflows/qc" - Build: strategy: fail-fast: false @@ -28,16 +29,21 @@ jobs: os: [ macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.checkoutRef }} - - name: Setup - uses: "./.github/workflows/setup" - - name: Set Short Hash - uses: "./.github/workflows/set-short-hash" - - name: "Build (${{ matrix.os }})" - uses: "./.github/workflows/build" + - name: 'Download Source Tarfiles' + uses: actions/download-artifact@v4 + with: + name: source + + - name: 'Unpack Source' + shell: bash + run: tar -xvf dissolve-versioned-source.tar + + - name: "Build (${{ matrix.os }})" + uses: "./.github/workflows/build" + with: + qtVersion: ${{ inputs.qtVersion }} + antlrVersion: ${{ inputs.antlrVersion }} + conanHash: ${{ inputs.conanHash }} BuildLinux: strategy: @@ -46,18 +52,21 @@ jobs: target: [ dissolve, dissolve-gui ] runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - name: 'Download Source Tarfiles' + uses: actions/download-artifact@v4 with: - ref: ${{ inputs.checkoutRef }} - - name: Setup - uses: "./.github/workflows/setup" - - name: Set Short Hash - uses: "./.github/workflows/set-short-hash" + name: source + + - name: 'Unpack Source' + shell: bash + run: tar -xvf dissolve-versioned-source.tar + - name: "Build, Test, Package (Linux, ${{ matrix.target }})" uses: "./.github/workflows/build" with: target: ${{ matrix.target }} + currentVersion: ${{ inputs.currentVersion }} + nixHash: ${{ inputs.nixHash }} Package: needs: Build @@ -67,11 +76,17 @@ jobs: os: [ macos-latest, windows-latest ] runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.checkoutRef }} - - name: Setup - uses: "./.github/workflows/setup" - - name: "Package (${{ matrix.os }})" - uses: "./.github/workflows/package" + - name: 'Download Source Tarfiles' + uses: actions/download-artifact@v4 + with: + name: source + + - name: 'Unpack Source' + shell: bash + run: tar -xvf dissolve-versioned-source.tar + + - name: "Package (${{ matrix.os }})" + uses: "./.github/workflows/package" + with: + currentVersion: ${{ inputs.currentVersion }} + qtVersion: ${{ inputs.qtVersion }} diff --git a/.github/workflows/_checkout.yml b/.github/workflows/_checkout.yml new file mode 100644 index 0000000000..996e22c75e --- /dev/null +++ b/.github/workflows/_checkout.yml @@ -0,0 +1,236 @@ +name: Checkout +description: Checks out the source and packages the source as an artifact for use by other workflow steps. Reversioning of the source to a git-cliff bumped version is performed if the "bump" flag is set. Tags are created / moved according to the value of 'publishType'. + +on: + workflow_call: + inputs: + qtVersion: + type: string + default: 6.4.2 + hugoVersion: + type: string + default: "0.135.0" + apptainerVersion: + type: string + default: "1.2.5" + conanfile: + type: string + default: cmake/Modules/conan-dissolve.cmake + publishType: + default: 'none' + type: string + checkoutRef: + default: '' + type: string + bump: + default: false + type: boolean + outputs: + currentVersion: + description: "Full version (MAJOR.MINOR.PATCH) determined from source, and after any reversioning" + value: ${{ jobs.Checkout.outputs.currentVersion }} + currentVersionMajor: + description: "MAJOR version determined from source, and after any reversioning" + value: ${{ jobs.Checkout.outputs.currentVersionMajor }} + currentVersionMinor: + description: "MINOR version determined from source, and after any reversioning" + value: ${{ jobs.Checkout.outputs.currentVersionMinor }} + currentVersionPatch: + description: "PATCH version determined from source, and after any reversioning" + value: ${{ jobs.Checkout.outputs.currentVersionPatch }} + currentShortHash: + description: "Short hash of the current HEAD commit" + value: ${{ jobs.Checkout.outputs.currentShortHash }} + qtVersion: + description: "Version of Qt required by the project" + value: ${{ jobs.Checkout.outputs.qtVersion }} + antlrVersion: + description: "Version of ANTLR required by the project (determined from conanfile)" + value: ${{ jobs.Checkout.outputs.antlrVersion }} + hugoVersion: + description: "Version of Hugo required for building website" + value: ${{ jobs.Checkout.outputs.hugoVersion }} + apptainerVersion: + description: "Version of Apptainer required for uploading to Harbor" + value: ${{ jobs.Checkout.outputs.apptainerVersion }} + nixHash: + description: "Hash of the current nix files (flake.lock and flake.nix)" + value: ${{ jobs.Checkout.outputs.nixHash }} + conanHash: + description: "Hash of the current conanfile" + value: ${{ jobs.Checkout.outputs.conanHash }} + +jobs: + + Checkout: + runs-on: ubuntu-latest + outputs: + currentVersion: ${{ steps.authVersion.outputs.currentVersion }} + currentVersionMajor: ${{ steps.authVersion.outputs.currentVersionMajor }} + currentVersionMinor: ${{ steps.authVersion.outputs.currentVersionMinor }} + currentVersionPatch: ${{ steps.authVersion.outputs.currentVersionPatch }} + currentShortHash: ${{ steps.authVersion.outputs.currentShortHash }} + qtVersion: ${{ steps.versions.outputs.qtVersion }} + antlrVersion: ${{ steps.versions.outputs.antlrVersion }} + hugoVersion: ${{ steps.versions.outputs.hugoVersion }} + apptainerVersion: ${{ steps.versions.outputs.apptainerVersion }} + nixHash: ${{ steps.hashes.outputs.nixHash }} + conanHash: ${{ steps.hashes.outputs.conanHash }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.checkoutRef }} + fetch-depth: 0 + + - name: Create Original Source Artifact + shell: bash + run: | + set -ex + tar -cvf ${{ runner.temp }}/dissolve-original-source.tar ./ + + - name: Set Required Versions + id: versions + shell: bash + run: | + set -ex + echo "qtVersion=${{ inputs.qtVersion }}" >> $GITHUB_OUTPUT + echo "hugoVersion=${{ inputs.hugoVersion }}" >> $GITHUB_OUTPUT + echo "apptainerVersion=${{ inputs.apptainerVersion }}" >> $GITHUB_OUTPUT + + ANTLR_VERSION=$(cat ${{ inputs.conanfile }} | sed -n -e 's%^.*antlr4-cppruntime/%%p') + echo "antlrVersion=${ANTLR_VERSION}" >> $GITHUB_OUTPUT + + - name: Get nix hash + shell: bash + run: | + set -ex + NIX_HASH=`sha256sum flake.lock | gawk '{print $1}'` + echo "Hash of nix files (flake.lock and flake.nix) is ${NIX_HASH}" + echo "nixHash=${NIX_HASH}" >> $GITHUB_OUTPUT + + CONAN_HASH=`sha256sum ${{ inputs.conanfile }} | gawk '{print $1}'` + echo "Hash of conanfile.txt is ${CONAN_HASH}" + echo "conanHash=${CONAN_HASH}" >> $GITHUB_OUTPUT + + - name: Set Short Hash + shell: bash + run: | + set -ex + SHORT_HASH=$(git rev-parse --short HEAD) + echo "Current short hash is ${SHORT_HASH}" + sed -i -e "s/DISSOLVESHORTHASH \".*\"/DISSOLVESHORTHASH \"${SHORT_HASH}\"/g" src/main/version.cpp + cat src/main/version.cpp + + - name: Get Cliff + uses: "./.github/workflows/get-cliff" + + - name: Generate ChangeLog.md + if: inputs.publishType != 'none' + shell: bash + run: | + set -ex + ./changeversion -l > ChangeLog.md + + - name: Bump Version + if: inputs.bump == true + shell: bash + run: | + set -ex + ./changeversion -b + ./changeversion -k + + - name: Tag Continuous + if: inputs.publishType == 'continuous' + shell: bash + run: | + set -ex + + # Move 'continuous' tag to the current HEAD + if [ $(git tag -l continuous) ] + then + echo "Tag 'continuous' exists and will be moved." + git tag --delete continuous + else + echo "Tag 'continuous' doesn't yet exist - it will be created." + fi + git tag continuous ${{ github.event.pull_request.merge_commit_sha }} + git show continuous + git push origin -f continuous + + - name: Tag Release + if: inputs.publishType == 'release' + shell: bash + run: | + set -ex + + # Get authoritative version at this point + CURRENT=$(./changeversion -v) + echo "Current version determined to be ${CURRENT}" + + BUMPED=$(./changeversion -q) + echo "Bumped version determined to be ${BUMPED}" + + # If the current and bumped versions differ then there is an issue... + if [ ${BUMPED} != ${CURRENT} ] + then + echo "Error: Current and bumped versions are different. Is this a valid release branch / point? Stopping here." + exit 1 + fi + + # Create the new version tag + if [ $(git tag -l ${BUMPED}) ] + then + echo "Error: Version tag ${BUMPED} alread exists." + exit 1 + fi + git tag ${BUMPED} ${{ github.event.pull_request.merge_commit_sha }} + git show ${BUMPED} + git push origin ${BUMPED} + + - name: Create / Check Release Root Branch + if: inputs.publishType == 'release' + shell: bash + run: | + set -ex + + # Get the root release branch name - version as MAJOR.MINOR.X + BRANCH="release/$(./changeversion -x)" + + # Create root release branch if it doesn't already exist + if git rev-parse --verify ${BRANCH} 2>/dev/null + then + echo "Release branch ${BRANCH} already exists." + else + git config user.name "${{ env.USER }}" + git config user.email "${{ env.EMAIL }}" + git checkout -b ${BRANCH} + + git push --set-upstream origin ${BRANCH} + fi + + - name: Get Authoritative Version Information + id: authVersion + shell: bash + run: | + set -ex + CURRENT=$(./changeversion -v) + echo "currentVersion=${CURRENT}" >> $GITHUB_OUTPUT + PARTS=($(echo ${CURRENT} | tr "." " ")) + echo "currentVersionMajor=${PARTS[0]}" >> $GITHUB_OUTPUT + echo "currentVersionMinor=${PARTS[1]}" >> $GITHUB_OUTPUT + echo "currentVersionPatch=${PARTS[2]}" >> $GITHUB_OUTPUT + echo "currentShortHash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Create Versioned Source Artifact + shell: bash + run: | + set -ex + tar -cvf ${{ runner.temp }}/dissolve-versioned-source.tar ./ + + - name: Upload Versioned Source Artifact + uses: actions/upload-artifact@v4 + with: + name: source + path: ${{ runner.temp }}/dissolve-*-source.tar + retention-days: 1 diff --git a/.github/workflows/_publish.yml b/.github/workflows/_publish.yml new file mode 100644 index 0000000000..fa45ca47ec --- /dev/null +++ b/.github/workflows/_publish.yml @@ -0,0 +1,90 @@ +name: Publishing + +on: + workflow_call: + inputs: + publishType: + required: true + type: string + description: "Publishing type" + apptainerVersion: + required: true + type: string + description: "Apptainer version to install and use" + currentVersion: + type: string + description: "Version being published" + releaseName: + type: string + description: "Name of the release as it will appear on GitHub" + releaseBody: + type: string + default: '' + description: "Body text of the release as it will appear on GitHub" + releaseBodyFile: + type: string + default: '' + description: "Body file to use for body text, used in preference to releaseBody if provided" + releaseTag: + type: string + default: '' + description: "Existing tag which the release will be associated to on GitHub" + secrets: + HARBOR_USER: + description: "Username for Harbor access" + HARBOR_SECRET: + description: "Key for Harbor access" + +jobs: + + Publish: + runs-on: ubuntu-latest + steps: + - name: 'Download Source Tarfiles' + uses: actions/download-artifact@v4 + with: + name: source + + - name: 'Unpack Source' + shell: bash + run: tar -xvf dissolve-versioned-source.tar + + - name: 'Install Apptainer' + if: inputs.publishType != 'none' + uses: eWaterCycle/setup-apptainer@v2 + with: + apptainer-version: ${{ inputs.apptainerVersion }} + + - name: 'Download Artifacts' + uses: actions/download-artifact@v4 + with: + pattern: packages-* + merge-multiple: true + path: ${{ github.workspace }}/packages + + - name: 'Package Examples' + shell: bash + run: | + set -ex + cd ./examples + ./package-examples -v ${{ inputs.currentVersion }} + + - name: 'Publish on GitHub' + if: inputs.publishType == 'release' || inputs.publishType == 'continuous' + uses: "./.github/workflows/create-release" + with: + releaseTag: ${{ inputs.releaseTag }} + releaseName: ${{ inputs.releaseName }} + releaseBody: ${{ inputs.releaseBody }} + releaseBodyFile: ${{ inputs.releaseBodyFile }} + releaseAssetsDirectory: "${{ github.workspace }}/packages" + updateRelease: ${{ inputs.publishType == 'continuous' }} + isPreRelease: ${{ inputs.publishType == 'continuous' }} + + - name: 'Publish on Harbor' + if: inputs.publishType != 'none' + 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 push packages/dissolve-gui-${{ inputs.currentVersion }}.sif oras://harbor.stfc.ac.uk/isis_disordered_materials/dissolve:${{ inputs.publishType }} diff --git a/.github/workflows/_publishing.yml b/.github/workflows/_publishing.yml deleted file mode 100644 index 305be91a8d..0000000000 --- a/.github/workflows/_publishing.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Publishing - -on: - workflow_call: - inputs: - publishType: - required: true - type: string - secrets: - HARBOR_USER: - description: "Username for Harbor access" - HARBOR_SECRET: - description: "Key for Harbor access" - -jobs: - - Publish: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup - uses: "./.github/workflows/setup" - - name: Set Short Hash - uses: "./.github/workflows/set-short-hash" - - name: Publish - uses: "./.github/workflows/publish" - with: - publishType: ${{ inputs.publishType }} - env: - HARBOR_USER: ${{ secrets.HARBOR_USER }} - HARBOR_SECRET: ${{ secrets.HARBOR_SECRET }} - - name: Update Version Information - uses: "./.github/workflows/update-release-info" - if: ${{ inputs.publishType == 'release' }} - with: - createPR: ${{ ! endsWith(github.ref, 'pre') }} - releaseVersion: ${{ env.dissolveVersion }} diff --git a/.github/workflows/_qc.yml b/.github/workflows/_qc.yml new file mode 100644 index 0000000000..f340b63840 --- /dev/null +++ b/.github/workflows/_qc.yml @@ -0,0 +1,34 @@ +name: Quality Control + +on: + workflow_call: + +jobs: + + Formatting: + runs-on: ubuntu-latest + steps: + - name: 'Download Source Tarfiles' + uses: actions/download-artifact@v4 + with: + name: source + + - name: 'Unpack Source' + shell: bash + run: tar -xvf dissolve-original-source.tar + + - name: Code Formatting + uses: "./.github/workflows/qc" + + ConventionalCommits: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Conventional Commits + shell: bash + env: + TITLE: ${{ github.event.pull_request.title }} + run: | + set -ex + echo "${TITLE}" | awk "/(^feat:)|(^fix:)|(^doc:)|(^perf:)|(^refactor:)|(^style:)|(^test:)|(^chore:)|(^revert:)|(^build:)/" | grep . + diff --git a/.github/workflows/_website.yml b/.github/workflows/_website.yml new file mode 100644 index 0000000000..af606b3fc6 --- /dev/null +++ b/.github/workflows/_website.yml @@ -0,0 +1,187 @@ +name: Website +description: Build and publish website + +on: + workflow_call: + inputs: + displayMajorVersion: + type: string + required: true + displayMinorVersion: + type: string + required: true + publishType: + type: string + default: 'none' + pdfExamples: + type: boolean + default: false + hugoVersion: + type: string + required: true + secrets: + SERVER_ID: + description: "ID for website access" + SERVER_KEY: + description: "Key for server access" + SERVER_USER: + description: "Username for server access" + SERVER_IP: + description: "Server IP address" + SERVER_DOCS_DIR: + description: "Directory on server for documentation data" + SERVER_MAIN_DIR: + description: "Directory on server for root website data" + +jobs: + + Website: + runs-on: ubuntu-latest + steps: + + - name: 'Download Source Tarfiles' + uses: actions/download-artifact@v4 + with: + name: source + + - name: 'Unpack Source' + shell: bash + run: tar -xvf dissolve-versioned-source.tar + + - name: 'Apply Main Release Styling' + if: ${{ inputs.publishType == 'release' }} + shell: bash + run: | + # Set version and tip visibility in docs index + sed -i 's/RELEASETYPE version MAJOR.MINOR/Release v${{ inputs.displayMajorVersion }}.${{ inputs.displayMinorVersion }}/g' web/docs/_index.md + sed -i "/RELEASE TIP/d" web/docs/_index.md + head -n 10 web/docs/_index.md + + - name: 'Apply Development Release Styling' + if: ${{ inputs.publishType == 'continuous' }} + shell: bash + run: | + # Set version and tip visibility in docs index + sed -i 's/RELEASETYPE version MAJOR.MINOR/Development version ${{ inputs.displayMajorVersion }}.${{ inputs.displayMinorVersion }}/g' web/docs/_index.md + sed -i "/DEVELOPMENT TIP/d" web/docs/_index.md + head -n 10 web/docs/_index.md + + # Change base url + sed -i 's|baseURL = .*|baseURL = "https://docs.projectdissolve.com/dev/"|g' web/docs.toml + grep baseURL web/docs.toml + + # Style navbar + sed -i "s/navbar-background-color/navbar-background-color-dev/g" web/assets/scss/_content.scss + grep navbar-background-color web/assets/scss/_content.scss + + - name: 'Apply Legacy Release Styling' + if: ${{ inputs.publishType == 'legacy' }} + shell: bash + run: | + # Set version and tip visibility in docs index + sed -i 's/RELEASETYPE version MAJOR.MINOR/Legacy version ${{ inputs.displayMajorVersion }}.${{ inputs.displayMinorVersion }}/g' web/docs/_index.md + sed -i "/LEGACY TIP/d" web/docs/_index.md + head -n 10 web/docs/_index.md + + # Change base url + sed -i 's|baseURL = .*|baseURL = "https://docs.projectdissolve.com/legacy/"|g' web/docs.toml + grep baseURL web/docs.toml + + # Style navbar + sed -i "s/navbar-background-color/navbar-background-color-legacy/g" web/assets/scss/_content.scss + grep navbar-background-color web/assets/scss/_content.scss + + - name: 'Download & Install Hugo (Extended Version)' + shell: bash + run: | + set -ex + wget https://github.com/gohugoio/hugo/releases/download/v${{ inputs.hugoVersion }}/hugo_extended_${{ inputs.hugoVersion }}_linux-amd64.deb -O '${{ github.workspace }}/hugo.deb' + sudo dpkg -i ${{ github.workspace }}/hugo*.deb + + - name: 'Install pandoc / xetex' + if: ${{ inputs.pdfExamples == 'true' }} + shell: bash + run: | + set -ex + sudo apt install pandoc + sudo apt install texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra texlive-xetex + + - name: 'Copy Icons' + shell: bash + run: | + set -ex + cp -rv src/gui/icons/* web/static/img + + - name: 'Meld Examples' + shell: bash + run: | + set -ex + for example in $(find ./web/docs/examples/ -mindepth 1 -maxdepth 1 -type d -not -iname previous) + do + ci/scripts/meld-example -d ${example} + done + + - name: 'Build Site' + shell: bash + run: | + set -ex + cd web + npm install + hugo --contentDir main/ --config main.toml --destination public + hugo --contentDir docs/ --config docs.toml --destination public-docs + + - name: 'Create PDFs' + if: ${{ inputs.pdfExamples == 'true' }} + shell: bash + run: | + set -ex + cd web/public-docs/examples/ + for example in $(find . -mindepth 1 -maxdepth 1 -type d -not -iname previous) + do + echo "Creating pdf for example \"${example}\"..." + cd ${example}/single/ + + # "Fix" image links + sed "s:/img:../../../static/img:g" index.html > index_pdf.html + + pandoc --pdf-engine=xelatex -V 'mainfont:DejaVuSerif.ttf' -V 'sansfont:DejaVuSans.ttf' -V 'monofont:DejaVuSansMono.ttf' index_pdf.html -o ../${example}.pdf + + # Tidy up + rm index_pdf.html + + cd ../../ + done + + - name: 'SSH Deploy to Server (Release) (Full)' + if: ${{ inputs.publishType == 'release' }} + shell: bash + run: | + echo "${SERVER_ID}" > ./serverId + echo "${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} + + - name: 'SSH Deploy to Server (Legacy) (Docs only)' + if: ${{ inputs.publishType == 'legacy' }} + shell: bash + run: | + echo "${SERVER_ID}" > ./serverId + echo "${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 + + - name: 'SSH Deploy to Server (Continuous) (Docs only)' + if: ${{ inputs.publishType == 'continuous' }} + shell: bash + run: | + echo "${SERVER_ID}" > ./serverId + echo "${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 + + - name: Upload Web Artifacts + uses: actions/upload-artifact@v4 + with: + name: web-artifacts + path: ${{ github.workspace }}/web/public* diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index feb95ff5b3..bce064c3ae 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -20,8 +20,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup - uses: "./.github/workflows/setup" - name: Install nix uses: "./.github/workflows/get-nix" diff --git a/.github/workflows/build/action.yml b/.github/workflows/build/action.yml index fe8fb1bd41..5bb1f6ba74 100644 --- a/.github/workflows/build/action.yml +++ b/.github/workflows/build/action.yml @@ -7,6 +7,21 @@ inputs: cacheOnly: type: boolean default: false + currentVersion: + type: string + description: "Version used for labelling packages and other artifacts" + qtVersion: + type: string + default: 'UNKNOWN' + antlrVersion: + type: string + default: 'UNKNOWN' + conanHash: + type: string + default: 'UNKNOWN' + nixHash: + type: string + default: 'UNKNOWN' runs: using: "composite" @@ -18,15 +33,23 @@ runs: with: target: ${{ inputs.target }} cacheOnly: ${{ inputs.cacheOnly }} + currentVersion: ${{ inputs.currentVersion }} + nixHash: ${{ inputs.nixHash }} - name: Build (OSX) if: runner.os == 'MacOS' uses: "./.github/workflows/build/osx" with: cacheOnly: ${{ inputs.cacheOnly }} + conanHash: ${{ inputs.conanHash }} + qtVersion: ${{ inputs.qtVersion }} + antlrVersion: ${{ inputs.antlrVersion }} - name: Build (Windows) if: runner.os == 'Windows' uses: "./.github/workflows/build/windows" with: cacheOnly: ${{ inputs.cacheOnly }} + conanHash: ${{ inputs.conanHash }} + qtVersion: ${{ inputs.qtVersion }} + antlrVersion: ${{ inputs.antlrVersion }} diff --git a/.github/workflows/build/linux/action.yml b/.github/workflows/build/linux/action.yml index 2697f530a3..9289dca757 100644 --- a/.github/workflows/build/linux/action.yml +++ b/.github/workflows/build/linux/action.yml @@ -7,6 +7,11 @@ inputs: cacheOnly: type: boolean default: false + currentVersion: + type: string + nixHash: + type: string + required: true runs: using: "composite" @@ -31,7 +36,7 @@ runs: id: nix-cache with: path: /tmp/nixcache - key: ${{ runner.os }}-${{ env.nixHash }}-nix-cache + key: ${{ runner.os }}-${{ inputs.nixHash }}-nix-cache - name: Import Nix Store Cache if: "steps.nix-cache.outputs.cache-hit == 'true'" @@ -87,7 +92,7 @@ runs: # Assemble artifacts mkdir packages-sif - cp -v result packages-sif/${{ inputs.target }}-${{ env.dissolveVersion }}.sif + cp -v result packages-sif/${{ inputs.target }}-${{ inputs.currentVersion }}.sif - name: Bundle Executable shell: bash @@ -98,7 +103,7 @@ runs: # Assemble artifacts mkdir packages-binary - cp -v binary packages-binary/${{ inputs.target }}-${{ env.dissolveVersion }} + cp -v binary packages-binary/${{ inputs.target }}-${{ inputs.currentVersion }} - name: Tidy nix Store if: ${{ inputs.cacheOnly == 'true' }} diff --git a/.github/workflows/build/osx/action.yml b/.github/workflows/build/osx/action.yml index d23b3310ff..034516e1f1 100644 --- a/.github/workflows/build/osx/action.yml +++ b/.github/workflows/build/osx/action.yml @@ -7,6 +7,15 @@ inputs: cacheOnly: type: boolean default: false + qtVersion: + type: string + required: true + antlrVersion: + type: string + required: true + conanHash: + type: string + required: true runs: using: "composite" @@ -22,14 +31,14 @@ runs: run: | set -ex brew update-reset - brew install ftgl ninja + brew install ftgl ninja gsl - name: Get ANTLR working-directory: ${{ runner.temp }} shell: bash run: | set -ex - wget https://www.antlr.org/download/antlr-${{ env.antlrVersion }}-complete.jar -Oantlr-${{ env.antlrVersion }}-complete.jar + wget https://www.antlr.org/download/antlr-${{ inputs.antlrVersion }}-complete.jar -Oantlr-${{ inputs.antlrVersion }}-complete.jar - name: Install Python Dependencies shell: bash @@ -40,7 +49,7 @@ runs: id: cache-qt uses: actions/cache@v4 with: - key: osx-qt-${{ env.qtVersion }} + key: osx-qt-${{ inputs.qtVersion }} path: ${{ runner.temp }}/qt - name: Install Qt @@ -48,7 +57,7 @@ runs: shell: bash run: | export PATH="$(python3 -m site --user-base)/bin:$PATH" - aqt install-qt --outputdir ${{ runner.temp }}/qt mac desktop ${{ env.qtVersion }} -m all + aqt install-qt --outputdir ${{ runner.temp }}/qt mac desktop ${{ inputs.qtVersion }} -m all # # Main Build @@ -58,7 +67,7 @@ runs: id: cache-conan uses: actions/cache@v4 with: - key: osx-${{ runner.arch }}-conan-${{ env.conanHash }} + key: osx-${{ runner.arch }}-conan-${{ inputs.conanHash }} path: | ~/.conan ~/.conancache @@ -72,11 +81,11 @@ runs: # Setup paths export PATH="$(python3 -m site --user-base)/bin:$PATH" - Qt6_DIR=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos/lib/cmake/Qt6 - QT_BASE_DIR=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos + Qt6_DIR=${{ runner.temp }}/qt/${{ inputs.qtVersion }}/macos/lib/cmake/Qt6 + QT_BASE_DIR=${{ runner.temp }}/qt/${{ inputs.qtVersion }}/macos # Find ANTLR4 - ANTLR_EXE="${{ runner.temp }}/antlr-${{ env.antlrVersion }}-complete.jar" + ANTLR_EXE="${{ runner.temp }}/antlr-${{ inputs.antlrVersion }}-complete.jar" echo "Detected ANTLR exe as [$ANTLR_EXE]" # Make sure we have a Java binary path - $JAVA_HOME_21_X64 does not appear to work on Silicon diff --git a/.github/workflows/build/windows/action.yml b/.github/workflows/build/windows/action.yml index f4ae684fd8..77e3cf62ca 100644 --- a/.github/workflows/build/windows/action.yml +++ b/.github/workflows/build/windows/action.yml @@ -11,6 +11,15 @@ inputs: cacheOnly: type: boolean default: false + qtVersion: + type: string + required: true + antlrVersion: + type: string + required: true + conanHash: + type: string + required: true runs: using: "composite" @@ -36,14 +45,14 @@ runs: id: cache-qt uses: actions/cache@v4 with: - key: windows-qt-${{ env.qtVersion }} + key: windows-qt-${{ inputs.qtVersion }} path: ${{ runner.temp }}\qt - name: Install Qt # if: ${{ steps.cache-qt.outputs.cache-hit != 'true' }} shell: bash run: | - aqt install-qt --outputdir ${RUNNER_TEMP}/qt windows desktop ${{ env.qtVersion }} win64_msvc2019_64 -m all + aqt install-qt --outputdir ${RUNNER_TEMP}/qt windows desktop ${{ inputs.qtVersion }} win64_msvc2019_64 -m all - name: Setup MSVC Compiler uses: ilammy/msvc-dev-cmd@v1 @@ -120,11 +129,10 @@ runs: shell: bash run: | set -ex - wget https://www.antlr.org/download/antlr-${{ env.antlrVersion }}-complete.jar -Oantlr-${{ env.antlrVersion }}-complete.jar + wget https://www.antlr.org/download/antlr-${{ inputs.antlrVersion }}-complete.jar -Oantlr-${{ inputs.antlrVersion }}-complete.jar wget https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.zip -Ojava.zip unzip java.zip - # # Main Build # @@ -133,7 +141,7 @@ runs: id: cache-conan uses: actions/cache@v4 with: - key: windows-conan-${{ env.conanHash }} + key: windows-conan-${{ inputs.conanHash }} path: | ~\.conan ~\.conancache @@ -142,7 +150,7 @@ runs: if: ${{ steps.cache-conan.outputs.cache-hit != 'true' }} shell: bash run: | - conan profile new default --detect + conan profile new default --detect --force conan profile update settings.compiler="Visual Studio" default conan profile update settings.compiler.version=17 default @@ -152,8 +160,8 @@ runs: run: | git submodule update --init --recursive # Setup environment - Qt6_DIR="${RUNNER_TEMP}\qt\${{ env.qtVersion }}\msvc2019_64" - ANTLR_EXE="${RUNNER_TEMP}\antlr-${{ env.antlrVersion }}-complete.jar" + Qt6_DIR="${RUNNER_TEMP}\qt\${{ inputs.qtVersion }}\msvc2019_64" + ANTLR_EXE="${RUNNER_TEMP}\antlr-${{ inputs.antlrVersion }}-complete.jar" export PATH="${Qt6_DIR}\bin;$PATH" INCLUDE="${RUNNER_TEMP}\freetype-latest;$INCLUDE" LIB="${RUNNER_TEMP}\freetype-install\lib;${RUNNER_TEMP}\freetype-install\bin;$LIB" diff --git a/.github/workflows/continuous.yml b/.github/workflows/continuous.yml index ad2e8ea98b..1e2261069e 100644 --- a/.github/workflows/continuous.yml +++ b/.github/workflows/continuous.yml @@ -18,14 +18,41 @@ on: jobs: + Checkout: + uses: "./.github/workflows/_checkout.yml" + with: + bump: true + publishType: 'continuous' + + QC: + needs: [Checkout] + uses: "./.github/workflows/_qc.yml" + BuildAndPackage: + needs: [Checkout] uses: "./.github/workflows/_build_and_package.yml" + with: + currentVersion: ${{ needs.Checkout.outputs.currentVersion }} + qtVersion: ${{ needs.Checkout.outputs.qtVersion }} + antlrVersion: ${{ needs.Checkout.outputs.antlrVersion }} + conanHash: ${{ needs.Checkout.outputs.conanHash }} + nixHash: ${{ needs.Checkout.outputs.nixHash }} + + Web: + needs: [Checkout] + uses: "./.github/workflows/_website.yml" + with: + publishType: 'continuous' + displayMajorVersion: ${{ needs.Checkout.outputs.majorVersion }} + displayMinorVersion: ${{ needs.Checkout.outputs.minorVersion }} + secrets: inherit Publish: - needs: [BuildAndPackage] - uses: "./.github/workflows/_publishing.yml" + needs: [Checkout,BuildAndPackage,Web] + uses: "./.github/workflows/_publish.yml" with: publishType: 'continuous' - secrets: - HARBOR_USER: ${{ secrets.HARBOR_USER }} - HARBOR_SECRET: ${{ secrets.HARBOR_SECRET }} + releaseTag: 'continuous' + releaseName: "Development Release ${{ needs.Checkout.outputs.currentVersion }} @ ${{ needs.Checkout.outputs.currentShortHash }}" + releaseBodyFile: ./ChangeLog.md + secrets: inherit diff --git a/.github/workflows/create-release/action.yml b/.github/workflows/create-release/action.yml new file mode 100755 index 0000000000..09874541ad --- /dev/null +++ b/.github/workflows/create-release/action.yml @@ -0,0 +1,229 @@ +name: Create Release + +inputs: + releaseTag: + type: string + required: true + description: "Existing tag which the release will be associated to on GitHub" + releaseName: + type: string + required: true + default: 'UnnamedRelease' + description: "Name of the release as it will appear on GitHub" + releaseBody: + type: string + default: '' + description: "Body text of the release as it will appear on GitHub" + releaseBodyFile: + type: string + default: '' + description: "Body file to use for body text, used in preference to releaseBody if provided" + releaseAssetsDirectory: + type: string + default: '' + description: 'Directory containing assets to upload to release' + curlOptions: + type: string + default: "-H 'Accept:application/vnd.github.v3+json' --silent --show-error" + description: 'Options to pass to curl' + isPreRelease: + type: boolean + default: false + description: 'Whether this irelease should be marked as a pre-release' + updateRelease: + type: boolean + default: false + description: 'Whether to update the tag SHA to reflect current HEAD and replace assets for the release' + +runs: + using: "composite" + steps: + + - name: Go + shell: bash + run: | + set -e + + # Old options not exposed (yet) + DELETE_EXISTING="false" + DELETE_EXISTING_ALWAYS="false" + + # Set up vars + echo "Repository is ${{ github.repository }}" + REPO_URL="https://api.github.com/repos/${{ github.repository }}" + echo "API URL is $REPO_URL" + + # Set body text from relevant source + RELEASE_BODY="" + if [ "x${{ inputs.releaseBodyFile }}" != "x" ] + then + echo "Body file provided: ${{ inputs.releaseBodyFile }}" + if [ -e ${{ inputs.releaseBodyFile }} ] + then + # Read in the file, preserving line-feeds + echo " -- Reading file...." + # Need to copy the var for use in the redirection below, otherwise it will cause a parse error on GH as the + # inputs.bodyFile is replaced with nothing. + BODYFILE=${{ inputs.releaseBodyFile }} + RELEASE_BODY=$(<${BODYFILE}) + else + echo "::error::Release body file ${{ inputs.releaseBodyFile }} does not exist." + exit 1 + fi + else + RELEASE_BODY="${{ inputs.releaseBody }}" + fi + echo "Body text is [${RELEASE_BODY}]." + + # Check tag + if [ "x${{ inputs.releaseTag }}" = "x" ] + then + echo "::error::No tag provided." + exit 1 + fi + echo "Tag for release is: ${{ inputs.releaseTag }}" + + # Check assets + HAS_ASSETS="false" + if [ "x${{ inputs.releaseAssetsDirectory }}" != "x" ] + then + # Check that this is a directory + if [ ! -d ${{ inputs.releaseAssetsDirectory }} ] + then + echo "::error::Directory ${{ inputs.releaseAssetsDirectory }} either doesn't exist or is not a directory." + exit 1 + fi + + # Check there is at least one file in the directory + if [ -z "$( ls -A ${{ inputs.releaseAssetsDirectory }})" ] + then + echo "::error::Provided assets directory is empty." + exit 1 + fi + + HAS_ASSETS="true" + echo "$(ls -A -1 ${{ inputs.releaseAssetsDirectory }} | wc -l) release assets found to upload." + fi + + # Get available releases information + RELEASES=$(curl ${{ inputs.curlOptions }} -XGET --header "Authorization: token ${{ github.token }}" ${REPO_URL}/releases) + + # Check for error or no data + if [[ ${RELEASES} =~ "documentation_url" ]] + then + MESSAGE=$(echo ${RELEASES} | jq ". | .message") + echo "::error::Error while getting available release information: ${MESSAGE}" + exit 1 + fi + + # Does our tag already exist (i.e. the release already exists)? + echo "Checking for presence of current release..." + FILTER=".[] | select(.tag_name | match(\"${{ inputs.releaseTag }}\"))" + CURRENT_RELEASE_INFO=$(echo $RELEASES | jq "$FILTER") + CURRENT_URL=$(echo ${CURRENT_RELEASE_INFO} | jq -r '. | .url') + + if [ "x$CURRENT_URL" != "x" ] + then + echo " -- Found existing release with tag ${{ inputs.releaseTag }}" + echo " url: $CURRENT_URL" + + if [ "${{ inputs.updateRelease }}" != "true" ] + then + echo "::error::Existing release found, but updateRelease = ${{ inputs.updateRelease }} so no further action will be taken." + exit 1 + fi + + # Update the current release + RELEASE_DATA=$(jq --null-input --arg tag "${{ inputs.releaseTag }}" --arg commitish "${TAG_HASH}" --arg name "${{ inputs.releaseName }}" --arg body "${RELEASE_BODY}" --argjson pre ${{ inputs.isPreRelease }} '{"tag_name": $tag, "target_commitish": $commitish, "name": $name, "body": $body, "draft": false, "prerelease": $pre}') + echo "Release data is:" + echo ${RELEASE_DATA} + + # Patch release + echo " -- Patching existing release info..." + RESULT=$(curl ${{ inputs.curlOptions }} -XPATCH --header "Authorization: token ${{ github.token }}" --data "${RELEASE_DATA}" ${CURRENT_URL}) + echo ${RESULT} + + # Delete existing assets + ASSETS=$(curl ${{ inputs.curlOptions }} -XGET --header "Authorization: token ${{ github.token }}" ${CURRENT_URL}/assets) + ASSET_IDS=$(echo $ASSETS | jq ".[] | .id") + for id in $ASSET_IDS + do + echo " -- Removing release asset id ${id}..." + RESULT=$(curl ${{ inputs.curlOptions }} -XDELETE --header "Authorization: token ${{ github.token }}" ${REPO_URL}/releases/assets/${id}) + done + else + echo " -- No release with tag ${{ inputs.releaseTag }} currently exists." + echo " A new one will be created." + + # Get the hash of the current revision + TAG_HASH=$(git rev-parse HEAD) + + # Construct release information + RELEASE_DATA=$(jq --null-input --arg tag "${{ inputs.releaseTag }}" --arg commitish "$TAG_HASH" --arg name "${{ inputs.releaseName }}" --arg body "${RELEASE_BODY}" --argjson pre $RELEASE_PRE '{"tag_name": $tag, "target_commitish": $commitish, "name": $name, "body": $body, "draft": false, "prerelease": $pre}') + echo "Release data is:" + echo ${RELEASE_DATA} + + # Create release + CURRENT_RELEASE_INFO=$(curl ${{ inputs.curlOptions }} --header "Authorization: token ${{ github.token }}" --data "${RELEASE_DATA}" ${REPO_URL}/releases) + echo "Release creation returned:" + echo ${CURRENT_RELEASE_INFO} + + # Check for messages + MSG=$(echo ${CURRENT_RELEASE_INFO} | jq -r '. | .message') + if [ "x$MSG" = "x" ] + then + echo "Received message:" + echo $MSG + fi + + # Check errors + ERRORS=$(echo ${CURRENT_RELEASE_INFO} | jq -r '. | .errors') + if [ "x$ERRORS" = "x" ] + then + echo "Error: Failed to create release." + echo "Reported error(s) are:" + echo $ERRORS + exit 1 + fi + + # Extract url + CURRENT_URL=$(echo ${CURRENT_RELEASE_INFO} | jq -r '. | .url') + fi + + # Upload assets if provided + if [ "${HAS_ASSETS}" == "true" ] + then + # Upload specified assets + echo "Uploading assets to release..." + + # Extract upload path for assets + # -- Need to strip trailing {?name,label} part from the returned url + UPLOAD_URL=$(echo ${CURRENT_RELEASE_INFO} | jq -r '. | .upload_url' | cut -d '{' -f 1) + if [ "x$UPLOAD_URL" = "x" ] + then + echo "Error: Failed to determine upload url for release." + exit 1 + fi + echo " -- Upload url is: $UPLOAD_URL" + + for file in $(ls -1 ${{ inputs.releaseAssetsDirectory }}) + do + echo "... ${file}" + + ARTIFACT_DATA=$(curl ${{ inputs.curlOptions }} --header "Authorization: token ${{ github.token }}" \ + --header "Accept: application/vnd.github.manifold-preview" \ + --header "Content-Type: application/octet-stream" \ + -T ${{ inputs.releaseAssetsDirectory }}/${file} \ + "$UPLOAD_URL?name=${file}") + + ARTIFACT_ID=$(echo $ARTIFACT_DATA | jq -r '. | .id') + ARTIFACT_URL=$(echo $ARTIFACT_DATA | jq -r '. | .browser_download_url') + if [ "x$ARTIFACT_ID" = "x" ] || [ "$ARTIFACT_ID" = "null" ] + then + echo "Error: Failed to upload artifact." + echo "Returned data was: $ARTIFACT_DATA" + exit 1 + fi + echo " -- Success (id: $ARTIFACT_ID, url: $ARTIFACT_URL)" + done + fi diff --git a/.github/workflows/detect_release.yml b/.github/workflows/detect_release.yml new file mode 100644 index 0000000000..f5f6669dcb --- /dev/null +++ b/.github/workflows/detect_release.yml @@ -0,0 +1,46 @@ +name: Detect Release +description: Runs on any merged release PR (actioned by prepare_release.yml) + +on: + pull_request: + types: + - closed + +jobs: + + Checkout: + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, '[Release]') + uses: "./.github/workflows/_checkout.yml" + secrets: inherit + with: + checkoutRef: ${{ github.event.pull_request.merge_commit_sha }} + publishType: 'release' + + BuildAndPackage: + needs: [Checkout] + uses: "./.github/workflows/_build_and_package.yml" + with: + currentVersion: ${{ needs.Checkout.outputs.currentVersion }} + qtVersion: ${{ needs.Checkout.outputs.qtVersion }} + antlrVersion: ${{ needs.Checkout.outputs.antlrVersion }} + conanHash: ${{ needs.Checkout.outputs.conanHash }} + nixHash: ${{ needs.Checkout.outputs.nixHash }} + + Web: + needs: [Checkout] + uses: "./.github/workflows/_website.yml" + with: + publishType: 'release' + displayMajorVersion: ${{ needs.Checkout.outputs.majorVersion }} + displayMinorVersion: ${{ needs.Checkout.outputs.minorVersion }} + secrets: inherit + + Publish: + needs: [Checkout,BuildAndPackage,Web] + uses: "./.github/workflows/_publish.yml" + with: + publishType: 'release' + releaseTag: ${{ needs.Checkout.outputs.currentVersion }} + releaseName: "Release ${{ needs.Checkout.outputs.currentVersion }}" + releaseBody: ${{ github.event.pull_request.body }} + secrets: inherit diff --git a/.github/workflows/get-cliff/action.yml b/.github/workflows/get-cliff/action.yml new file mode 100644 index 0000000000..354ef64a0f --- /dev/null +++ b/.github/workflows/get-cliff/action.yml @@ -0,0 +1,20 @@ +name: Get Git Cliff + +runs: + using: "composite" + steps: + + - name: Cache Rust + uses: actions/cache@v4 + id: rust-cache + with: + path: ~/.cargo + key: ${{ runner.os }}-rust-cache + + - name: Install Prerequisites + shell: bash + run: | + set -ex + rustup default + cargo install git-cliff + diff --git a/.github/workflows/legacy.yml b/.github/workflows/legacy.yml index 8b084627fa..3e68af62d9 100644 --- a/.github/workflows/legacy.yml +++ b/.github/workflows/legacy.yml @@ -7,14 +7,32 @@ on: jobs: + Checkout: + uses: "./.github/workflows/_checkout.yml" + BuildAndPackage: + needs: [Checkout] uses: "./.github/workflows/_build_and_package.yml" + with: + currentVersion: ${{ needs.Checkout.outputs.currentVersion }} + qtVersion: ${{ needs.Checkout.outputs.qtVersion }} + antlrVersion: ${{ needs.Checkout.outputs.antlrVersion }} + conanHash: ${{ needs.Checkout.outputs.conanHash }} + nixHash: ${{ needs.Checkout.outputs.nixHash }} + + Web: + needs: [Checkout] + uses: "./.github/workflows/_website.yml" + with: + publishType: 'legacy' + displayMajorVersion: ${{ needs.Checkout.outputs.majorVersion }} + displayMinorVersion: ${{ needs.Checkout.outputs.minorVersion }} + secrets: inherit Publish: - needs: [BuildAndPackage] - uses: "./.github/workflows/_publishing.yml" + needs: [Checkout,BuildAndPackage,Web] + uses: "./.github/workflows/_publish.yml" with: publishType: 'legacy' - secrets: - HARBOR_USER: ${{ secrets.HARBOR_USER }} - HARBOR_SECRET: ${{ secrets.HARBOR_SECRET }} + apptainerVersion: ${{ needs.Checkout.outputs.apptainerVersion }} + secrets: inherit diff --git a/.github/workflows/package/action.yml b/.github/workflows/package/action.yml index 9fa93953dd..8f1a4681a3 100644 --- a/.github/workflows/package/action.yml +++ b/.github/workflows/package/action.yml @@ -1,6 +1,16 @@ name: Package description: Stub action for package creation +inputs: + currentVersion: + type: string + description: "Version used for labelling packages and other artifacts" + required: true + qtVersion: + type: string + required: true + description: "Qt version required in the package (same as build version)" + runs: using: "composite" steps: @@ -8,7 +18,13 @@ runs: - name: Package (OSX) if: runner.os == 'MacOS' uses: "./.github/workflows/package/osx" + with: + currentVersion: ${{ inputs.currentVersion }} + qtVersion: ${{ inputs.qtVersion }} - name: Package (Windows) if: runner.os == 'Windows' uses: "./.github/workflows/package/windows" + with: + currentVersion: ${{ inputs.currentVersion }} + qtVersion: ${{ inputs.qtVersion }} diff --git a/.github/workflows/package/osx/action.yml b/.github/workflows/package/osx/action.yml index b5106356da..a0fe1cb488 100644 --- a/.github/workflows/package/osx/action.yml +++ b/.github/workflows/package/osx/action.yml @@ -1,6 +1,14 @@ name: Package description: Package OSX artifacts +inputs: + currentVersion: + type: string + required: true + qtVersion: + type: string + required: true + runs: using: "composite" steps: @@ -8,7 +16,7 @@ runs: - name: Retrieve Qt Cache uses: actions/cache@v4 with: - key: osx-qt-${{ env.qtVersion }} + key: osx-qt-${{ inputs.qtVersion }} path: ${{ runner.temp }}/qt - name: Download Raw Build Artifacts @@ -33,7 +41,7 @@ runs: shell: bash run: | set -ex - Qt6_ROOT=${{ runner.temp }}/qt/${{ env.qtVersion }}/macos/ + Qt6_ROOT=${{ runner.temp }}/qt/${{ inputs.qtVersion }}/macos/ export PATH="$(python3 -m site --user-base)/bin:$PATH" # Add rpath to packaged Frameworks @@ -42,10 +50,10 @@ runs: # Set variables appName=Dissolve-GUI-${{ runner.arch }} appDirName=${appName}.app - packageName=Dissolve-GUI-${{ runner.arch }}-${{ env.dissolveVersion }} + packageName=Dissolve-GUI-${{ runner.arch }}-${{ inputs.currentVersion }} # Prepare the dmg file content - ./prep-dmg -a Dissolve-GUI-${{ runner.arch }} -v ${{ env.dissolveVersion }} -b build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui -d ${Qt6_ROOT} -i icon/icon-1024x1024.png -p build/bin/dissolve-gui.app/Contents/Info.plist -q src/gui/qml + ./prep-dmg -a Dissolve-GUI-${{ runner.arch }} -v ${{ inputs.currentVersion }} -b build/bin/dissolve-gui.app/Contents/MacOS/dissolve-gui -d ${Qt6_ROOT} -i icon/icon-1024x1024.png -p build/bin/dissolve-gui.app/Contents/Info.plist -q src/gui/qml # Copy dependencies into Frameworks folder in app bundle cp -v ./build/antlr4-cppruntime/lib/*.dylib ${packageName}/${appDirName}/Contents/Frameworks/ @@ -61,14 +69,14 @@ runs: # Set variables appName=Dissolve-GUI-${{ runner.arch }} appDirName=${appName}.app - packageName=Dissolve-GUI-${{ runner.arch }}-${{ env.dissolveVersion }} - dmgName=Dissolve-GUI-${{ env.dissolveVersion }}-${{ runner.arch }} + packageName=Dissolve-GUI-${{ runner.arch }}-${{ inputs.currentVersion }} + dmgName=Dissolve-GUI-${{ inputs.currentVersion }}-${{ runner.arch }} # Fix icon name in plist sed -i -e "s/Dissolve.icns/${appName}.icns/g" ${packageName}/${appDirName}/Contents/Info.plist # Create DMG - dmgbuild -s ci/osx/dmgbuild-settings.py -D app=./${packageName}/${appDirName} -D icon=./Dissolve-GUI-${{ env.dissolveVersion }}/${appDirName}/Contents/Resources/${appName}.icns "Dissolve GUI" ${dmgName}.dmg + dmgbuild -s ci/osx/dmgbuild-settings.py -D app=./${packageName}/${appDirName} -D icon=./Dissolve-GUI-${{ inputs.currentVersion }}/${appDirName}/Contents/Resources/${appName}.icns "Dissolve GUI" ${dmgName}.dmg # Collect artifacts mkdir packages diff --git a/.github/workflows/package/windows/action.yml b/.github/workflows/package/windows/action.yml index 34565a65f5..54f0aab54f 100644 --- a/.github/workflows/package/windows/action.yml +++ b/.github/workflows/package/windows/action.yml @@ -1,6 +1,14 @@ name: Package description: Package Windows artifacts +inputs: + currentVersion: + type: string + required: true + qtVersion: + type: string + required: true + runs: using: "composite" steps: @@ -12,7 +20,7 @@ runs: - name: Retrieve Qt Cache uses: actions/cache@v4 with: - key: windows-qt-${{ env.qtVersion }} + key: windows-qt-${{ inputs.qtVersion }} path: ${{ runner.temp }}\qt - name: Retrieve FTGL Cache @@ -53,12 +61,13 @@ runs: set -ex # Setup environment - export Qt6_DIR="${RUNNER_TEMP}\qt\${{ env.qtVersion }}\msvc2019_64" + export Qt6_DIR="${RUNNER_TEMP}\qt\${{ inputs.qtVersion }}\msvc2019_64" export PATH="${Qt6_DIR}\bin;$PATH" export FREETYPE_DIR="${RUNNER_TEMP}\freetype-install\bin" export FTGL_DIR="${RUNNER_TEMP}\ftgl-install\bin" export DISSOLVE_DIR="${GITHUB_WORKSPACE}\build\install\bin" export DEPLOY_DIR="${GITHUB_WORKSPACE}\build" + export DISSOLVE_VERSION="${{ inputs.currentVersion }}" # Run Inno Setup Compiler iscc.exe -O./ ./ci/windows/dissolve-gui.iss diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index aeca94f6f4..52990c26fb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -19,7 +19,30 @@ on: jobs: + Checkout: + uses: "./.github/workflows/_checkout.yml" + with: + checkoutRef: ${{ github.event.pull_request.head.sha }} + + QC: + needs: [Checkout] + uses: "./.github/workflows/_qc.yml" + BuildAndPackage: + needs: [Checkout] uses: "./.github/workflows/_build_and_package.yml" with: - checkoutRef: ${{ github.event.pull_request.head.sha }} + currentVersion: ${{ needs.Checkout.outputs.currentVersion }} + qtVersion: ${{ needs.Checkout.outputs.qtVersion }} + antlrVersion: ${{ needs.Checkout.outputs.antlrVersion }} + conanHash: ${{ needs.Checkout.outputs.conanHash }} + nixHash: ${{ needs.Checkout.outputs.nixHash }} + + Web: + needs: [Checkout] + uses: "./.github/workflows/_website.yml" + with: + publishType: 'none' + displayMajorVersion: ${{ needs.Checkout.outputs.majorVersion }} + displayMinorVersion: ${{ needs.Checkout.outputs.minorVersion }} + hugoVersion: ${{ needs.Checkout.outputs.hugoVersion }} diff --git a/.github/workflows/prepare_release.yml b/.github/workflows/prepare_release.yml new file mode 100644 index 0000000000..c418893bda --- /dev/null +++ b/.github/workflows/prepare_release.yml @@ -0,0 +1,110 @@ +name: Prepare Release +description: A purely workflow dispatch action that should be run on a branch containing some sort of versioned history, the top commits of which are to be included in a version-bumped release. + +on: + workflow_dispatch: + inputs: + cacheOnly: + type: boolean + default: false + +jobs: + + PrepareRelease: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cache Rust + uses: actions/cache@v4 + id: rust-cache + with: + path: ~/.cargo + key: ${{ runner.os }}-rust-cache + + - name: Install Prerequisites + shell: bash + run: | + set -ex + rustup default + cargo install git-cliff + + - name: Zero Change Check + if: ${{ inputs.cacheOnly != 'true' }} + shell: bash + run: | + set -ex + if [ "$(./changeversion -t)" == "none" ] + then + echo "::error::Current and bumped versions are the same - no changes have been made, and no release will be generated." + exit 1 + fi + + - name: Check Patch on Develop + if: inputs.cacheOnly != 'true' && github.ref == 'refs/heads/develop' + shell: bash + run: | + set -ex + if [ "$(./changeversion -t)" == "patch" ] + then + echo "::error::Patch versions can't be released on the develop branch." + exit 1 + fi + + - name: Check No Patch on Release + if: inputs.cacheOnly != 'true' && startsWith(github.ref, 'refs/heads/release/') + shell: bash + run: | + set -ex + if [ "$(./changeversion -t)" != "patch" ] + then + echo "::error::Can't release a major / minor version on an existing release branch." + exit 1 + fi + + - name: Determine Current Version + if: ${{ inputs.cacheOnly != 'true' }} + id: prep + shell: bash + run: | + set -ex + + # Get the current authoritative version from the code. On develop this will + # be the same as the last released version. + CURRENT=$(./changeversion -v) + echo "Current version determined to be ${CURRENT}" + + # Get the next bumped version + BUMPED=$(./changeversion -q) + echo "Bumped version determined to be ${BUMPED}" + echo "version=${BUMPED}" >> "$GITHUB_OUTPUT" + + # Get name for PR branch + BRANCH="make-release/${BUMPED}" + echo "branch=${BRANCH}" >> "$GITHUB_OUTPUT" + if git show-ref --quiet refs/heads/${BRANCH} + then + echo "::error::PR branch ${BRANCH} already exists!" + exit 1 + fi + + # Before we change the version we generate the ChangeLog.md inathe temp dir so we don't commit it + ./changeversion -l > ${{ runner.temp }}/ChangeLog.md + + # Set new version, check authoritative, and check consistency + ./changeversion -b + ./changeversion -v + ./changeversion -k + + - name: Create Update PR + if: ${{ inputs.cacheOnly != 'true' }} + uses: peter-evans/create-pull-request@v7 + with: + branch: ${{ steps.prep.outputs.branch }} + title: "[Release] ${{ steps.prep.outputs.version }}" + body-path: ${{ runner.temp }}/ChangeLog.md + reviewers: trisyoungs + sign-commits: true diff --git a/.github/workflows/publish/action.yml b/.github/workflows/publish/action.yml deleted file mode 100644 index 50c954f0b0..0000000000 --- a/.github/workflows/publish/action.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Publish -description: Publish artifacts online - -inputs: - publishType: - type: choice - default: 'none' - options: - - none - - continuous - - release - - legacy - -runs: - using: "composite" - steps: - - - name: Install Apptainer - uses: eWaterCycle/setup-apptainer@v2 - with: - apptainer-version: 1.2.5 - - - name: Download Artifacts - uses: actions/download-artifact@v4 - with: - pattern: packages-* - merge-multiple: true - path: ${{ github.workspace }}/packages - - - name: Download Prerequisites - shell: bash - run: | - wget https://raw.githubusercontent.com/disorderedmaterials/scripts/master/update-release - chmod u+x ./update-release - - - name: Package Examples - shell: bash - run: | - set -ex - cd ./examples - ./package-examples -v ${{ env.dissolveVersion }} - - - name: Publish on GitHub (Release) - if: ${{ inputs.publishType == 'release' }} - shell: bash - run: | - echo "Release tag/name will be: ${{ env.dissolveVersion }}" - export GITHUB_TOKEN=${{ github.token }} - ./update-release -r disorderedmaterials/dissolve -t ${{ env.dissolveVersion }} -n "${{ env.dissolveVersion }}" -f ReleaseNotes.md packages/* examples/*.zip examples/*.tar.gz - - - name: Publish on GitHub (Continuous) - if: ${{ inputs.publishType == 'continuous' }} - shell: bash - run: | - echo "Release tag will be: continuous" - echo "Release name will be: 'Continuous (${{ env.dissolveVersion }} @ ${{ env.dissolveShortHash }})'" - export GITHUB_TOKEN=${{ github.token }} - ./update-release -r disorderedmaterials/dissolve -t continuous -p -e -u -n "Continuous (${{ env.dissolveVersion }} @ ${{ env.dissolveShortHash }})" -b "Continuous release from \`develop\` branch @ ${{ env.dissolveShortHash }}. Built $(date)." packages/* - - - name: Publish on Harbor - if: ${{ inputs.publishType != 'none' }} - 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 push packages/dissolve-gui-${{ env.dissolveVersion }}.sif oras://harbor.stfc.ac.uk/isis_disordered_materials/dissolve:${{ inputs.publishType }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 64b4941669..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Release - -on: - push: - branches: - - 'release/*' - paths-ignore: - - '.github/workflows/benchmark.yml' - - '.github/workflows/cacheConan.yml' - - '.github/workflows/cacheNix.yml' - - '.github/workflows/pr.yml' - - '.github/workflows/release.yml' - - '.github/workflows/web**' - - 'web/**' - - 'README.md' - -jobs: - - BuildAndPackage: - uses: "./.github/workflows/_build_and_package.yml" - - Publish: - needs: [BuildAndPackage] - uses: "./.github/workflows/_publishing.yml" - with: - publishType: 'release' - secrets: - HARBOR_USER: ${{ secrets.HARBOR_USER }} - HARBOR_SECRET: ${{ secrets.HARBOR_SECRET }} diff --git a/.github/workflows/set-short-hash/action.yml b/.github/workflows/set-short-hash/action.yml deleted file mode 100644 index d8348c1e64..0000000000 --- a/.github/workflows/set-short-hash/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Set Short Hash - -runs: - using: "composite" - steps: - - - name: Set Short Hash - shell: bash - run: | - set -ex - SHORT_HASH=$(git rev-parse --short HEAD) - echo "Current short hash is ${SHORT_HASH}" - sed -i -e "s/DISSOLVESHORTHASH \".*\"/DISSOLVESHORTHASH \"${SHORT_HASH}\"/g" src/main/version.cpp - cat src/main/version.cpp - echo "dissolveShortHash=${SHORT_HASH}" >> ${GITHUB_ENV} diff --git a/.github/workflows/setup/action.yml b/.github/workflows/setup/action.yml deleted file mode 100644 index c9416a11f8..0000000000 --- a/.github/workflows/setup/action.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Basic Setup -description: Set up environment variables - -inputs: - qtVersion: - type: string - default: 6.4.2 - nixVersion: - type: string - default: 2.4 - nixOSVersion: - type: string - default: 22.11 - hugoVersion: - type: string - default: "0.135.0" - conanfile: - type: string - default: cmake/Modules/conan-dissolve.cmake - -runs: - using: "composite" - steps: - - - name: Setup environment - shell: bash - run: | - set -ex - echo "qtVersion=${{ inputs.qtVersion }}" >> ${GITHUB_ENV} - echo "nixVersion=${{ inputs.nixVersion }}" >> ${GITHUB_ENV} - echo "nixOSVersion=${{ inputs.nixOSVersion }}" >> ${GITHUB_ENV} - echo "hugoVersion=${{ inputs.hugoVersion }}" >> ${GITHUB_ENV} - - - name: Get code version - shell: bash - run: | - set -ex - DISSOLVE_VERSION=`grep "#define DISSOLVEVERSION" src/main/version.cpp | sed 's/.*\"\(.*\)\"/\1/g'` - echo "Dissolve code version is ${DISSOLVE_VERSION}" - DISSOLVE_MAJOR=`echo $DISSOLVE_VERSION | sed "s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/g"` - DISSOLVE_MINOR=`echo $DISSOLVE_VERSION | sed "s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/g"` - DISSOLVE_PATCH=`echo $DISSOLVE_VERSION | sed "s/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/g"` - echo "Dissolve major version is ${DISSOLVE_MAJOR}" - echo "dissolveVersion=${DISSOLVE_VERSION}" >> ${GITHUB_ENV} - echo "dissolveMajorVersion=${DISSOLVE_MAJOR}" >> ${GITHUB_ENV} - echo "dissolveMinorVersion=${DISSOLVE_MINOR}" >> ${GITHUB_ENV} - echo "dissolvePatchVersion=${DISSOLVE_PATCH}" >> ${GITHUB_ENV} - - - name: Get package versions - shell: bash - run: | - ANTLR_VERSION=$(cat ${{ inputs.conanfile }} | sed -n -e 's%^.*antlr4-cppruntime/%%p') - echo "antlrVersion=${ANTLR_VERSION}" >> ${GITHUB_ENV} - - - name: Install Dependencies (OSX) - if: ${{ runner.os == 'macos' }} - shell: bash - run: brew install coreutils gawk gsl - - - name: Get nix hash - shell: bash - run: | - set -ex - NIX_HASH=`sha256sum flake.lock | gawk '{print $1}'` - echo "Hash of nix files (flake.lock and flake.nix) is ${NIX_HASH}" - echo "nixHash=${NIX_HASH}" >> ${GITHUB_ENV} - - - name: Get conan hash - shell: bash - run: | - set -ex - CONAN_HASH=`sha256sum ${{ inputs.conanfile }} | gawk '{print $1}'` - echo "Hash of conanfile.txt is ${CONAN_HASH}" - echo "conanHash=${CONAN_HASH}" >> ${GITHUB_ENV} diff --git a/.github/workflows/update-release-info/action.yml b/.github/workflows/update-release-info/action.yml deleted file mode 100644 index 385bccaaca..0000000000 --- a/.github/workflows/update-release-info/action.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Update Release Info -description: List releases and update website info - -inputs: - repository: - type: string - default: disorderedmaterials/dissolve - oldReleasesFile: - type: string - default: web/static/include/old_releases.md - createPR: - type: boolean - default: true - releaseVersion: - type: string - -runs: - using: "composite" - steps: - - - name: Checkout Develop - uses: actions/checkout@v4 - with: - ref: develop - - - name: Get Release Information - shell: bash - run: | - # Set up vars - echo "Repository is ${{ inputs.repository }}" - REPO_URL="https://api.github.com/repos/${{ inputs.repository }}" - echo "API URL is ${REPO_URL}" - - # Check if we are actually on a release branch - ON_RELEASE=$(git branch --show-current | sed "s/releases\?\/\([0-9].[0-9].[0-9]\)/\1/g") - if [ "x${ON_RELEASE}" = "x" ] - then - echo "On a branch that doesn't appear to be a release ($(git branch --show-current)). Exiting now." - exit 1 - fi - - # Get available releases information - RELEASES="" - for i in `seq 1 3` - do - # Download release information - we may be refused data because another job is currently accessing the repo, so try a few times - RELEASES=$(curl --silent --show-error -XGET --header "Authorization: token ${{ github.token }}" ${REPO_URL}/releases) - - # Check for error or no data - if [[ ${RELEASES} =~ "documentation_url" ]] - then - MESSAGE=$(echo ${RELEASES} | jq ". | .message") - echo "Error returned: "${MESSAGE} - exit 1 - elif (( ${#RELEASES} < 10 )) - then - echo "... Empty information returned - waiting 60 seconds and trying again..." - sleep 60 - else - break - fi - done - - # Filter releases so we only have release versions (tagged as release[s]/X.Y.Z) - echo "Obtaining release information..." - for tag in $(echo ${RELEASES} | jq -r ".[] | select(.tag_name | match(\"[0-9].[0-9].[0-9]\")) | .tag_name") - do - echo "Processing ${tag}..." - - # Get full release info - RELEASE=$(echo ${RELEASES} | jq ".[] | select(.tag_name | match(\"${tag}\"))") - URL=$(echo ${RELEASE} | jq -r ". | .html_url") - PUBLISHED=$(date --date=$(echo ${RELEASE} | jq -r ". | .published_at") +"%-d %B %Y") - echo " -- published at ${PUBLISHED}" - echo " -- $URL" - echo "- [Version ${tag}, released ${PUBLISHED}]($URL)" >> ${{ inputs.oldReleasesFile }}.new - done - - echo "" - cat ${{ inputs.oldReleasesFile }}.new - echo "" - - - name: Update Release Information - shell: bash - run: | - # Set release version to ours - ./changeversion release -s ${{ inputs.releaseVersion }} - - # Copy the old releases data, excluding the most recent (HIGHEST) - grep -v "Version ${{ inputs.releaseVersion }}" ${{ inputs.oldReleasesFile }}.new > ${{ inputs.oldReleasesFile }} - - cat ${{ inputs.oldReleasesFile }} - - # Clean-up - rm ${{ inputs.oldReleasesFile }}.new - - - name: Create Update PR - if: ${{ inputs.createPR == 'true' }} - uses: peter-evans/create-pull-request@v4 - with: - base: develop - add-paths: | - ${{ inputs.oldReleasesFile }} - README.md - web/main.toml - commit-message: Update release version info. - delete-branch: true - branch: automation/update-current-release-to-${{ inputs.releaseVersion }} - title: Update website release info (v${{ inputs.releaseVersion }}) - reviewers: trisyoungs diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml deleted file mode 100644 index 85e185b435..0000000000 --- a/.github/workflows/web.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Website Build - -on: - pull_request: - branches: - - '*' - paths: - - '.github/workflows/web**' - - 'web/**' - - push: - branches: - - 'develop' - - 'release/**' - paths: - - '.github/workflows/web**' - - 'web/**' - -jobs: - - BuildWeb: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup - uses: "./.github/workflows/setup" - - - name: Build Website - Test Only - if: ${{ github.event_name == 'pull_request' }} - uses: "./.github/workflows/website" - with: - publishType: 'none' - - - name: Build and Publish Website (Development Version) - if: ${{ github.ref_name == 'develop' }} - uses: "./.github/workflows/website" - with: - publishType: 'continuous' - env: - SERVER_ID: ${{ secrets.SERVER_ID }} - SERVER_KEY: ${{ secrets.SERVER_KEY }} - SERVER_USER: ${{ secrets.SERVER_USER }} - SERVER_IP: ${{ secrets.SERVER_IP }} - SERVER_DOCS_DIR: ${{ secrets.SERVER_DOCS_DIR }} - SERVER_MAIN_DIR: ${{ secrets.SERVER_MAIN_DIR }} - SERVER_PORT: ${{ secrets.SERVER_PORT }} - - - name: Build and Publish Website (Release Version) - if: ${{ startsWith(github.ref_name, 'release') }} - uses: "./.github/workflows/website" - with: - publishType: 'release' - env: - SERVER_ID: ${{ secrets.SERVER_ID }} - SERVER_KEY: ${{ secrets.SERVER_KEY }} - SERVER_USER: ${{ secrets.SERVER_USER }} - SERVER_IP: ${{ secrets.SERVER_IP }} - SERVER_DOCS_DIR: ${{ secrets.SERVER_DOCS_DIR }} - SERVER_MAIN_DIR: ${{ secrets.SERVER_MAIN_DIR }} - SERVER_PORT: ${{ secrets.SERVER_PORT }} - - - name: Build and Publish Website (Legacy Version) - if: ${{ github.ref_name == 'legacy' }} - uses: "./.github/workflows/website" - with: - publishType: 'legacy' - env: - SERVER_ID: ${{ secrets.SERVER_ID }} - SERVER_KEY: ${{ secrets.SERVER_KEY }} - SERVER_USER: ${{ secrets.SERVER_USER }} - SERVER_IP: ${{ secrets.SERVER_IP }} - SERVER_DOCS_DIR: ${{ secrets.SERVER_DOCS_DIR }} - SERVER_MAIN_DIR: ${{ secrets.SERVER_MAIN_DIR }} - SERVER_PORT: ${{ secrets.SERVER_PORT }} diff --git a/.github/workflows/website/action.yml b/.github/workflows/website/action.yml deleted file mode 100644 index 0e03a05f9c..0000000000 --- a/.github/workflows/website/action.yml +++ /dev/null @@ -1,161 +0,0 @@ -name: Website -description: Build and publish website - -inputs: - publishType: - type: choice - default: 'none' - options: - - none - - continuous - - release - - legacy - pdfExamples: - type: boolean - default: false - -runs: - using: "composite" - steps: - - - name: 'Set Version in Main Config' - shell: bash - run: sed -i "s/MAJOR.MINOR/${{ env.dissolveMajorVersion }}.${{ env.dissolveMinorVersion }}/g" web/docs.toml - - - name: 'Apply Main Release Styling' - if: ${{ inputs.publishType == 'release' }} - shell: bash - run: | - # Set version and tip visibility in docs index - sed -i 's/RELEASETYPE version MAJOR.MINOR/Release v${{ env.dissolveMajorVersion }}.${{ env.dissolveMinorVersion }}/g' web/docs/_index.md - sed -i "/RELEASE TIP/d" web/docs/_index.md - head -n 10 web/docs/_index.md - - - name: 'Apply Development Release Styling' - if: ${{ inputs.publishType == 'continuous' }} - shell: bash - run: | - # Set version and tip visibility in docs index - sed -i 's/RELEASETYPE version MAJOR.MINOR/Development version ${{ env.dissolveMajorVersion }}.${{ env.dissolveMinorVersion }}/g' web/docs/_index.md - sed -i "/DEVELOPMENT TIP/d" web/docs/_index.md - head -n 10 web/docs/_index.md - - # Change base url - sed -i 's|baseURL = .*|baseURL = "https://docs.projectdissolve.com/dev/"|g' web/docs.toml - grep baseURL web/docs.toml - - # Style navbar - sed -i "s/navbar-background-color/navbar-background-color-dev/g" web/assets/scss/_content.scss - grep navbar-background-color web/assets/scss/_content.scss - - - name: 'Apply Legacy Release Styling' - if: ${{ inputs.publishType == 'legacy' }} - shell: bash - run: | - # Set version and tip visibility in docs index - sed -i 's/RELEASETYPE version MAJOR.MINOR/Legacy version ${{ env.dissolveMajorVersion }}.${{ env.dissolveMinorVersion }}/g' web/docs/_index.md - sed -i "/LEGACY TIP/d" web/docs/_index.md - head -n 10 web/docs/_index.md - - # Change base url - sed -i 's|baseURL = .*|baseURL = "https://docs.projectdissolve.com/legacy/"|g' web/docs.toml - grep baseURL web/docs.toml - - # Style navbar - sed -i "s/navbar-background-color/navbar-background-color-legacy/g" web/assets/scss/_content.scss - grep navbar-background-color web/assets/scss/_content.scss - - - name: 'Download & Install Hugo (Extended Version)' - shell: bash - run: | - set -ex - wget https://github.com/gohugoio/hugo/releases/download/v${{ env.hugoVersion }}/hugo_extended_${{ env.hugoVersion }}_linux-amd64.deb -O '${{ github.workspace }}/hugo.deb' - sudo dpkg -i ${{ github.workspace }}/hugo*.deb - - - name: 'Install pandoc / xetex' - if: ${{ inputs.pdfExamples == 'true' }} - shell: bash - run: | - set -ex - sudo apt install pandoc - sudo apt install texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra texlive-xetex - - - name: 'Copy Icons' - shell: bash - run: | - set -ex - cp -rv src/gui/icons/* web/static/img - - - name: 'Meld Examples' - shell: bash - run: | - set -ex - for example in $(find ./web/docs/examples/ -mindepth 1 -maxdepth 1 -type d -not -iname previous) - do - ci/scripts/meld-example -d ${example} - done - - - name: 'Build Site' - shell: bash - run: | - set -ex - cd web - npm install - hugo --contentDir main/ --config main.toml --destination public - hugo --contentDir docs/ --config docs.toml --destination public-docs - - - name: 'Create PDFs' - if: ${{ inputs.pdfExamples == 'true' }} - shell: bash - run: | - set -ex - cd web/public-docs/examples/ - for example in $(find . -mindepth 1 -maxdepth 1 -type d -not -iname previous) - do - echo "Creating pdf for example \"${example}\"..." - cd ${example}/single/ - - # "Fix" image links - sed "s:/img:../../../static/img:g" index.html > index_pdf.html - - pandoc --pdf-engine=xelatex -V 'mainfont:DejaVuSerif.ttf' -V 'sansfont:DejaVuSans.ttf' -V 'monofont:DejaVuSansMono.ttf' index_pdf.html -o ../${example}.pdf - - # Tidy up - rm index_pdf.html - - cd ../../ - done - - - name: 'SSH Deploy to Server (Release) (Docs only)' - if: ${{ inputs.publishType == 'release' }} - shell: bash - run: | - echo "${SERVER_ID}" > ./serverId - echo "${SERVER_KEY}" > ./serverKey - chmod 0600 ./serverKey ./serverId - 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} - - - name: 'SSH Deploy to Server (Legacy) (Docs only)' - if: ${{ inputs.publishType == 'legacy' }} - shell: bash - run: | - echo "${SERVER_ID}" > ./serverId - echo "${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 - - - name: 'SSH Deploy to Server (Continuous)' - if: ${{ inputs.publishType == 'continuous' }} - shell: bash - run: | - echo "${SERVER_ID}" > ./serverId - echo "${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 -e "ssh -o UserKnownHostsFile=./serverId -i ./serverKey -p ${SERVER_PORT} -l ${SERVER_USER}" web/public-docs/ ${SERVER_IP}:${SERVER_DOCS_DIR}/dev - - - name: Upload Web Artifacts - uses: actions/upload-artifact@v4 - with: - name: web-artifacts - path: ${{ github.workspace }}/web/public* diff --git a/README.md b/README.md index e734707827..5eaf435899 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ ![Dissolve's Logo](icon/logo.png) -_Last Release: 1.6.0, Monday 9th December 2024_ - -_Release Build::_ [![Release Build Status](https://github.com/disorderedmaterials/dissolve/actions/workflows/release.yml/badge.svg)](https://github.com/disorderedmaterials/dissolve/actions/workflows/release.yml) _Development Build::_ [![Development Build Status](https://github.com/disorderedmaterials/dissolve/actions/workflows/continuous.yml/badge.svg)](https://github.com/disorderedmaterials/dissolve/actions/workflows/continuous.yml) ## Overview diff --git a/changeversion b/changeversion index 0c3d92807a..54722913f0 100755 --- a/changeversion +++ b/changeversion @@ -12,201 +12,259 @@ DaySuffix() { esac } -usage() { - echo "Usage: $0 [-r] [-s X.Y.Z]" - echo " -r Calculate new version (only on release branch)" - echo " -s Set version explicitly to X.Y.Z" - echo "" - echo "TARGET is one of: code - change version numbering in code, and installer and packaging scripts" - echo " release - change release version value on web and date in README.md" - echo " develop - change development version value on web" - echo "" - echo "If no options are specified the default behaviour is to print current versions across relevant files." +# Retrieve the authoritative code version from src/main/version.cpp +GetAuthoritativeVersion() { + echo $(grep '#define DISSOLVEVERSION' src/main/version.cpp | sed -e 's/#define DISSOLVEVERSION "\([0-9a-z\.]\+\).*"/\1/g') } -# Check for no args provided -if [ $# == 0 ] -then - usage - exit 1 -fi +# Set versions in build files +SetCodeVersion() { + # Must have new version string as argument + if [ $# == 0 ] + then + echo "Must pass version string as argument to SetWebReleaseInfo()." + exit 1 + fi -# Get target type and shift to next option -TYPE=$1 -shift -if [ "$TYPE" != "code" ] && [ "$TYPE" != "release" ] && [ "$TYPE" != "develop" ] -then - echo "Invalid target '${TYPE}' given (must be 'code', 'release', 'develop'" - exit 1 -fi + # Program (main/version.h) + sed -i -e "s/#define DISSOLVEVERSION \"[0-9\.]\+\(.*\)\"/#define DISSOLVEVERSION \"$1\"\1/g" src/main/version.cpp -# Get current version number from correct target -if [ "$TYPE" == "code" ] -then - CURRENT_VERSION=$(grep '#define DISSOLVEVERSION' src/main/version.cpp | sed -e 's/#define DISSOLVEVERSION "\([0-9a-z\.]\+\).*"/\1/g') -elif [ "$TYPE" == "release" ] -then - CURRENT_VERSION=$(grep 'releaseVersion' web/main.toml | sed -e 's/releaseVersion = "\([0-9\.]*\)"/\1/g') -else - CURRENT_VERSION=$(grep 'devVersion' web/main.toml | sed -e 's/devVersion = "\([0-9\.]*\)"/\1/g') -fi -PARTS=($(echo $CURRENT_VERSION | tr "." " ")) -MAJOR=${PARTS[0]} -MINOR=${PARTS[1]} -PATCH=${PARTS[2]} -CHECK="true" -echo "Current major version (${TYPE}) is : ${MAJOR}" -echo "Current minor version (${TYPE}) is : ${MINOR}" -echo "Current patch version (${TYPE}) is : ${PATCH}" - -while getopts ":rs:" opt -do - case $opt in - s) MAJOR=$(echo $OPTARG | cut -f1 -d.) - MINOR=$(echo $OPTARG | cut -f2 -d.) - PATCH=$(echo $OPTARG | cut -f3 -d.) - CHECK="false" - echo "Version will be set explicitly to MAJOR=$MAJOR MINOR=$MINOR PATCH=$PATCH" - ;; - r) BRANCH=$(git rev-parse --abbrev-ref HEAD) - if [ "$BRANCH" != "Release" ] - then - echo "Version number can only be auto-calculated on the Release branch" - exit 1 - fi - # Get next version number from git-cliff - PARTS=($(git cliff --bumped-version | tr "." " ")) - MAJOR=${PARTS[0]} - MINOR=${PARTS[1]} - PATCH=${PARTS[2]} - echo "Version will calculated to be MAJOR=$MAJOR MINOR=$MINOR PATCH=$PATCH" - # Update Changelog - git cliff --bump v1.3.3..HEAD > ChangeLog.md - ;; - \?) usage - exit 1 - ;; - *) echo "Error: Extra operands given." - usage - exit 1 - ;; - esac -done + # Flake (flake.nix) + sed -i -e "s/version = \".*\"/version = \"$1\"/" flake.nix -######################################### -# Code / Installer / Packaging Versions # -######################################### + # Root ./CMakeLists.txt + PARTS=($(echo $1 | tr "." " ")) + MAJOR=${PARTS[0]} + MINOR=${PARTS[1]} + PATCH=${PARTS[2]} + sed -i -e "s/set(VERSION_MAJOR \"\([0-9\.]\+\)\")/set(VERSION_MAJOR \"$MAJOR\")/g" -e "s/set(VERSION_MINOR \"\([0-9a-z\.]\+\)\")/set(VERSION_MINOR \"$MINOR\")/g" -e "s/set(VERSION_PATCH \"\([0-9a-z\.]\+\)\")/set(VERSION_PATCH \"$PATCH\")/g" CMakeLists.txt -if [ "$TYPE" = "code" ] -then +} + +# Get / check code versions in build files +GetCodeVersion() { # Program (main/version.h) - if [ "$CHECK" = "false" ] - then - sed -i -e "s/#define DISSOLVEVERSION \"[0-9\.]\+\(.*\)\"/#define DISSOLVEVERSION \"$MAJOR.$MINOR.$PATCH\"\1/g" src/main/version.cpp - fi - echo -n " version.cpp (Program Version) : " - grep '#define DISSOLVEVERSION' src/main/version.cpp | sed -e 's/#define DISSOLVEVERSION "\([0-9a-z\.]\+\).*"/\1/g' - - + MAIN_VERSION=$(grep '#define DISSOLVEVERSION' src/main/version.cpp | sed -e 's/#define DISSOLVEVERSION "\([0-9a-z\.]\+\).*"/\1/g') + echo " version.cpp : ${MAIN_VERSION}" + # Flake (flake.nix) - if [ "$CHECK" = "false" ] - then - sed -i -e "s/version = \".*\"/version = \"$MAJOR.$MINOR.$PATCH\"/" flake.nix - fi - echo -n " flake.nix (Program Version) : " - grep " version =" flake.nix | sed -e "s/\W*version = \"\(.*\)\";/\1/" + FLAKE_VERSION=$(grep " version =" flake.nix | sed -e "s/\W*version = \"\(.*\)\";/\1/") + echo " flake.nix : ${FLAKE_VERSION}" + # Root ./CMakeLists.txt + CMAKE_MAJOR=$(grep 'set(VERSION_MAJOR' ./CMakeLists.txt | sed -e 's/set(VERSION_MAJOR \"\([0-9a-z\.]\+\)\")/\1/g') + CMAKE_MINOR=$(grep 'set(VERSION_MINOR' ./CMakeLists.txt | sed -e 's/set(VERSION_MINOR \"\([0-9a-z\.]\+\)\")/\1/g') + CMAKE_PATCH=$(grep 'set(VERSION_PATCH' ./CMakeLists.txt | sed -e 's/set(VERSION_PATCH \"\([0-9a-z\.]\+\)\")/\1/g') + CMAKE_VERSION="${CMAKE_MAJOR}.${CMAKE_MINOR}.${CMAKE_PATCH}" + echo " ./CMakeLists.txt : ${CMAKE_VERSION}" - # ./CMakeLists.txt - if [ "$CHECK" = "false" ] + # Check Version? + if [ $# == 1 ] then - sed -i -e "s/set(VERSION_MAJOR \"\([0-9\.]\+\)\")/set(VERSION_MAJOR \"$MAJOR\")/g" -e "s/set(VERSION_MINOR \"\([0-9a-z\.]\+\)\")/set(VERSION_MINOR \"$MINOR\")/g" -e "s/set(VERSION_PATCH \"\([0-9a-z\.]\+\)\")/set(VERSION_PATCH \"$PATCH\")/g" CMakeLists.txt + if [ ${MAIN_VERSION} != "$1" ] + then + echo "!!! Version mismatch in version.cpp: ${MAIN_VERSION} != $1" + return 1 + fi + + if [ ${FLAKE_VERSION} != "$1" ] + then + echo "!!! Version mismatch in flake.nix: ${FLAKE_VERSION} != $1" + return 1 + fi + + if [ ${CMAKE_VERSION} != "$1" ] + then + echo "!!! Version mismatch in CMakeLists.cpp: ${CMAKE_VERSION} != $1" + return 1 + fi fi - echo -n " ./CMakeLists.txt (Major Version) : " - grep 'set(VERSION_MAJOR' ./CMakeLists.txt | sed -e 's/set(VERSION_MAJOR \"\([0-9a-z\.]\+\)\")/\1/g' - echo -n " (Minor Version) : " - grep 'set(VERSION_MINOR' ./CMakeLists.txt | sed -e 's/set(VERSION_MINOR \"\([0-9a-z\.]\+\)\")/\1/g' - echo -n " (Patch Version) : " - grep 'set(VERSION_PATCH' ./CMakeLists.txt | sed -e 's/set(VERSION_PATCH \"\([0-9a-z\.]\+\)\")/\1/g' + + 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' - # Windows build files - if [ "$CHECK" = "false" ] +# Set web release version and date +SetWebReleaseInfo() { + # Must have new version string as argument + if [ $# == 0 ] then - 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 "Must pass version string as argument to SetWebReleaseInfo()." + exit 1 fi - 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' -fi + # Get today's date, nicely formatted + DAYSUFFIX=$(DaySuffix) + TODAY=$(date "+%A %-d${DAYSUFFIX} %B %Y") + # Set releaseVersion and releaseDat on Website (web/main.toml) + sed -i -e "s/releaseVersion = \"[0-9\.]*\"/releaseVersion = \"$1\"/g" web/main.toml + sed -i -e "s/releaseDate = \".*\"/releaseDate = \"${TODAY}\"/g" web/main.toml +} -########################## -# Website Version / Date # -########################## +# Get web release version and date +GetWebReleaseInfo() { + # Release version on Website (web/main.toml) + WEB_VERSION=$(grep 'releaseVersion' web/main.toml | sed -e 's/releaseVersion = "\([0-9\.]*\)"/\1/g') + WEB_DATE=$(grep 'releaseDate' web/main.toml | sed -e 's/releaseDate = "\(.*\)"/\1/g') + echo " main.toml (Version) : ${WEB_VERSION}" + echo " main.toml (Date) : ${WEB_DATE}" -if [ "$TYPE" = "release" ] -then - # Website (web/main.toml) - if [ "$CHECK" = "false" ] + # Check Version? + if [ $# == 1 ] && [ ${WEB_VERSION} != "$1" ] then - sed -i -e "s/releaseVersion = \"[0-9\.]*\"/releaseVersion = \"$MAJOR.$MINOR.$PATCH\"/g" web/main.toml - - DAYSUFFIX=$(DaySuffix) - TODAY=$(date "+%-d${DAYSUFFIX} %B %Y") - sed -i -e "s/releaseDate = \".*\"/releaseDate = \"${TODAY}\"/g" web/main.toml + echo "!!! Version mismatch in web/main.toml: ${WEB_VERSION} != $1" + return 1 fi - echo -n " main.toml (Release Version) : " - grep 'releaseVersion' web/main.toml | sed -e 's/releaseVersion = "\([0-9\.]*\)"/\1/g' - echo -n " main.toml (Release Date) : " - grep 'releaseDate' web/main.toml | sed -e 's/releaseDate = "\(.*\)"/\1/g' - # Website (web/docs.toml) - if [ "$CHECK" = "false" ] - then - sed -i -e "s/releaseVersion = \"[0-9\.]*\"/releaseVersion = \"$MAJOR.$MINOR.$PATCH\"/g" web/docs.toml - DAYSUFFIX=$(DaySuffix) - TODAY=$(date "+%-d${DAYSUFFIX} %B %Y") - sed -i -e "s/releaseDate = \".*\"/releaseDate = \"${TODAY}\"/g" web/docs.toml - fi - echo -n " docs.toml (Release Version) : " - grep 'releaseVersion' web/docs.toml | sed -e 's/releaseVersion = "\([0-9\.]*\)"/\1/g' - echo -n " docs.toml (Release Date) : " - grep 'releaseDate' web/docs.toml | sed -e 's/releaseDate = "\(.*\)"/\1/g' -fi + return 0 +} -if [ "$TYPE" = "develop" ] -then - # Website (web/main.toml) - if [ "$CHECK" = "false" ] +# Set README.md version and date +SetReadMeInfo() { + # Must have new version string as argument + if [ $# == 0 ] then - sed -i -e "s/devVersion = \"[0-9\.]*\"/devVersion = \"$MAJOR.$MINOR.$PATCH\"/g" web/main.toml + echo "Must pass version string as argument to SetReadMeInfo()." + exit 1 fi - echo -n " main.toml (Develop Version) : " - grep 'devVersion' web/main.toml | sed -e 's/devVersion = "\([0-9\.]*\)"/\1/g' -fi + # Get today's date, nicely formatted + DAYSUFFIX=$(DaySuffix) + TODAY=$(date "+%A %-d${DAYSUFFIX} %B %Y") -############# -# README.md # -############# + # Set the Last Release in the repository's root README.md + sed -i -e "s/Last Release: [0-9\.]*, \(.*\)_/Last Release: $1, ${TODAY}_/g" README.md +} -if [ "$TYPE" = "release" ] -then - # README.md - if [ "$CHECK" = "false" ] +# Get README.md version and date +GetReadMeInfo() { + # Last Release in the repository's root README.md + README_VERSION=$(grep 'Last Release:' README.md | sed -e 's/.*Release: \([0-9\.]*\),.*/\1/g') + README_DATE=$(grep 'Last Release:' README.md | sed -e "s/.*Release: .*, \(.*\)_/\1/g") + echo " README.md (Version) : ${README_VERSION}" + echo " README.md (Date) : ${README_DATE}" + + # Check Version? + if [ $# == 1 ] && [ ${README_VERSION} != "$1" ] then - DAYSUFFIX=$(DaySuffix) - TODAY=$(date "+%A %-d${DAYSUFFIX} %B %Y") - sed -i -e "s/Last Release: [0-9\.]*, \(.*\)_/Last Release: $MAJOR.$MINOR.$PATCH, ${TODAY}_/g" README.md + echo "!!! Version mismatch in web/main.toml: ${WEB_VERSION} != $1" + return 1 fi - echo -n " README.md (Release Version) : " - grep 'Last Release:' README.md | sed -e 's/.*Release: \([0-9\.]*\),.*/\1/g' - echo -n " README.md (Release Date) : " - grep 'Last Release:' README.md | sed -e "s/.*Release: .*, \(.*\)_/\1/g" + + return 0 +} + +ConsistencyCheck() { + RETURN=0 + # Get authoritative source code version + SRC_VERSION=$(GetAuthoritativeVersion) + if ! GetWebReleaseInfo ${SRC_VERSION}; then RETURN=1; fi + if ! GetCodeVersion ${SRC_VERSION}; then RETURN=1; fi + exit $(( RETURN )) +} + +PrintUsage() { + echo "Usage: $0 [-v] [-k] [-t] [-q] [-r X.Y.Z] [-s X.Y.Z]" + echo " -r Explicitly set release version and date in README.md" + echo " -s Set version explicitly to X.Y.Z" + echo " -v Get authoritative code version (from src/main/version.cpp)" + echo " -x Get authoritative code version (from src/main/version.cpp) with patch version set to a literal 'X'" + echo " -k Check consistency of other files with current authoritative version" + echo " -q Determine bumped version using git-cliff" + echo " -t Determine type (major, minor, patch, or none) of bumped version using git-cliff" + echo " -b Determine bumped version using git-cliff and set new authoritative version" + echo " -l Generate ChangeLog.md containing unreleased changes since last major/minor/patch release" + echo " -L Generate ChangeLog.md over the current branch history" +} + +# Check for no args provided +if [ $# == 0 ] +then + PrintUsage + exit 1 fi -exit 0 +while getopts "r:s:vkqblLxt" opt +do + case $opt in + s) PARTS=($(echo $OPTARG | tr "." " ")) + MAJOR=${PARTS[0]} + MINOR=${PARTS[1]} + PATCH=${PARTS[2]} + echo "Code and web version will be set explicitly to MAJOR=$MAJOR MINOR=$MINOR PATCH=$PATCH" + SetCodeVersion $OPTARG + SetWebReleaseInfo $OPTARG + ConsistencyCheck + ;; + r) PARTS=($(echo $OPTARG | tr "." " ")) + MAJOR=${PARTS[0]} + MINOR=${PARTS[1]} + PATCH=${PARTS[2]} + echo "Release version will be set explicitly to MAJOR=$MAJOR MINOR=$MINOR PATCH=$PATCH" + SetReadMeInfo $OPTARG + GetReadMeInfo + ;; + q) git cliff --bumped-version + ;; + b) BUMPED=$(git cliff --bumped-version) + echo "BUMPED = ${BUMPED}" + if [ "${BUMPED}x" == "x" ] + then + echo "Error: Failed to auto-bump version." + exit 1 + fi + SetCodeVersion ${BUMPED} + SetWebReleaseInfo ${BUMPED} + ;; + l) git cliff --bump -u + ;; + L) git cliff --bump + ;; + v) GetAuthoritativeVersion + exit 0 + ;; + x) CURRENT=$(GetAuthoritativeVersion) + PARTS=($(echo $CURRENT | tr "." " ")) + MAJOR=${PARTS[0]} + MINOR=${PARTS[1]} + echo "${MAJOR}.${MINOR}.X" + exit 0 + ;; + k) ConsistencyCheck + ;; + t) CURRENT=$(GetAuthoritativeVersion) + CURRENT_PARTS=($(echo $CURRENT | tr "." " ")) + BUMPED=$(git cliff --bumped-version) + BUMPED_PARTS=($(echo $BUMPED | tr "." " ")) + if [ "${CURRENT_PARTS[0]}" != "${BUMPED_PARTS[0]}" ] + then + echo "major" + elif [ "${CURRENT_PARTS[1]}" != "${BUMPED_PARTS[1]}" ] + then + echo "minor" + elif [ "${CURRENT_PARTS[2]}" != "${BUMPED_PARTS[2]}" ] + then + echo "patch" + else + echo "none" + fi + exit 0 + ;; + \?) PrintUsage + exit 1 + ;; + *) echo "Error: Extra operands given." + PrintUsage + exit 1 + ;; + esac +done diff --git a/ci/windows/dissolve-gui.iss b/ci/windows/dissolve-gui.iss index 7b2b200980..16cfaae2c1 100644 --- a/ci/windows/dissolve-gui.iss +++ b/ci/windows/dissolve-gui.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "Dissolve-GUI" -#define MyAppVersion "1.6.0" +#define MyAppVersion GetEnv('DISSOLVE_VERSION') #define MyAppPublisher "Team Dissolve" #define MyAppURL "https://www.projectdissolve.com/" #define MyAppExeName "Dissolve-GUI.exe" @@ -31,7 +31,7 @@ DefaultDirName={commonpf}\Dissolve-GUI DefaultGroupName={#MyAppName} LicenseFile=..\..\LICENSE.txt OutputDir=..\..\ -OutputBaseFilename=Dissolve-GUI-1.6.0-Win64 +OutputBaseFilename=Dissolve-GUI-{#MyAppVersion}-Win64 SetupIconFile=Dissolve.ico Compression=lzma SolidCompression=yes diff --git a/cliff.toml b/cliff.toml index d4554dacfe..9a891d03eb 100644 --- a/cliff.toml +++ b/cliff.toml @@ -9,7 +9,6 @@ # changelog header header = """ # Changelog\n -All notable changes to this project will be documented in this file.\n """ # template for the changelog body # https://keats.github.io/tera/docs/#introduction @@ -77,7 +76,7 @@ protect_breaking_commits = false # filter out the commits that are not matched by commit parsers filter_commits = false # regex for matching git tags -# tag_pattern = "v[0-9].*" +tag_pattern = "[0-9].*" # regex for skipping tags # skip_tags = "" # regex for ignoring tags diff --git a/web/docs.toml b/web/docs.toml index 9e89a752e2..435111e2c6 100644 --- a/web/docs.toml +++ b/web/docs.toml @@ -47,8 +47,6 @@ latexDashes = true # General Parameters [params] copyright = "Team Dissolve and contributors. Built using Hugo/Docsy." -releaseVersion = "1.4.1" -releaseDate = "17th January 2024" github_repo = "https://github.com/disorderedmaterials/dissolve" github_subdir = "web" github_branch = "develop" @@ -78,4 +76,4 @@ proxy = "direct" [[module.imports]] path = "github.com/google/docsy" [[module.imports]] -path = "github.com/google/docsy/dependencies" \ No newline at end of file +path = "github.com/google/docsy/dependencies" diff --git a/web/layouts/shortcodes/continuouslink.html b/web/layouts/shortcodes/continuouslink.html deleted file mode 100644 index a8a1812a41..0000000000 --- a/web/layouts/shortcodes/continuouslink.html +++ /dev/null @@ -1,9 +0,0 @@ -{{ $urlSuffix := .Get "urlSuffix" }} -{{ $textSuffix := .Get "textSuffix" }} -{{ $target := .Get "target" }} -{{ if (eq $target "GUI") }} -Development {{ .Site.Params.devVersion }}{{ with $textSuffix }} {{ . | markdownify }}{{ end }} -{{ end }} -{{ if (eq $target "examples") }} -Example Data {{ .Site.Params.devVersion }}{{ with $textSuffix }} {{ . | markdownify }}{{ end }} -{{ end }} diff --git a/web/layouts/shortcodes/continuousversion.html b/web/layouts/shortcodes/continuousversion.html deleted file mode 100644 index 450cda7685..0000000000 --- a/web/layouts/shortcodes/continuousversion.html +++ /dev/null @@ -1 +0,0 @@ -{{- $.Site.Params.devVersion -}} diff --git a/web/main.toml b/web/main.toml index d6ac27552f..449d3bc3a5 100644 --- a/web/main.toml +++ b/web/main.toml @@ -49,7 +49,6 @@ latexDashes = true copyright = "Team Dissolve and contributors. Built using Hugo/Docsy." releaseVersion = "1.6.0" releaseDate = "9th December 2024" -devVersion = "1.6.0" github_repo = "https://github.com/disorderedmaterials/dissolve" github_subdir = "web" github_branch = "develop" diff --git a/web/main/packages.md b/web/main/packages.md index d69eccbfa7..7a00a1b3eb 100644 --- a/web/main/packages.md +++ b/web/main/packages.md @@ -3,11 +3,7 @@ title = "Dissolve" linkTitle = "Packages" +++ -{{< blocks/cover title="Packages" image_anchor="top" height="min" >}} -
-

Current Release: {{< releaseversion >}}

-

Development Version: {{< continuousversion >}}

-
+{{< blocks/cover title="Pre-Built Packages" image_anchor="top" height="min" >}} {{< /blocks/cover >}} @@ -64,52 +60,35 @@ linkTitle = "Packages" {{< blocks/section color="secondary" >}}
-

Development Version {{< continuousversion >}}

+

Development Version

{{< /blocks/section >}} {{< blocks/section color="secondary" >}}
-

These packages are built dynamically from the development branch and as such contain the most up-to-date functionality, but may also contain bugs and other undocumented features. If you use these versions and discover a bug, please submit an issue to highlight it. Please include the unique hash value of the version you were using in your report.

-

To see all of the available packages for the continuous release, head over to GitHub.

+

Packages built dynamically from the development branch can be found on GitHub. These packages contain the most up-to-date functionality, but may also contain bugs and other undocumented features. If you use these versions and discover a bug, please submit an issue to highlight it. Please include the unique hash value of the version you were using in your report.

{{< /blocks/section >}} {{< blocks/section color="secondary" >}} - -{{% blocks/feature icon="fab fa-linux" title="Linux" %}} -{{< continuouslink target="GUI" urlSuffix="-x86_64.AppImage" textSuffix="AppImage" >}} -{{% /blocks/feature %}} - -{{% blocks/feature icon=" fab fa-apple" title="Mac OS" %}} -{{< continuouslink target="GUI" urlSuffix=".dmg" textSuffix="DMG" >}} -{{% /blocks/feature %}} - -{{% blocks/feature icon="fab fa-windows" title="Windows" textSuffix="Installer" %}} -{{< continuouslink target="GUI" urlSuffix="-Win64.exe" textSuffix="Installer" >}} -{{< continuouslink target="GUI" urlSuffix="-Win64.zip" textSuffix="Zip Archive" >}} -{{% /blocks/feature %}} - -{{% blocks/feature icon="fa fa-archive" title="Example Data" %}} -{{< continuouslink target="examples" urlSuffix=".tar.gz" textSuffix="GZipped Tarball" >}} -{{< continuouslink target="examples" urlSuffix=".zip" textSuffix="Zip Archive" >}} -{{% /blocks/feature %}} - {{< /blocks/section >}} + {{< blocks/section color="white" >}}
-

Older Versions

+

Legacy Versions

{{< /blocks/section >}} {{< blocks/section color="white" >}} -{{< include "./static/include/old_releases.md" >}} +
+

Older versions of Dissolve can be found on the releases page on GitHub. +

{{< /blocks/section >}} {{< blocks/section color="white" >}}