Skip to content

Commit

Permalink
build: Update release publishing workflow (#2018)
Browse files Browse the repository at this point in the history
  • Loading branch information
trisyoungs authored Nov 26, 2024
1 parent 06d6602 commit fe4da06
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 59 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,28 @@ jobs:
- name: Publish
uses: "./.github/workflows/publish"
with:
isRelease: false
publish: true
publishType: 'continuous'
env:
HARBOR_USER: ${{ secrets.HARBOR_USER }}
HARBOR_SECRET: ${{ secrets.HARBOR_SECRET }}

Web:
needs: [ Package, BuildLinux ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: "./.github/workflows/setup"
- name: Build Website
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 }}
37 changes: 15 additions & 22 deletions .github/workflows/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ name: Publish
description: Publish artifacts online

inputs:
isRelease:
type: boolean
default: false
publish:
type: boolean
default: true
publishType:
type: choice
default: 'none'
options:
- none
- continuous
- release
- legacy

runs:
using: "composite"
Expand Down Expand Up @@ -39,35 +41,26 @@ runs:
./package-examples -v ${{ env.dissolveVersion }}
- name: Publish on GitHub (Release)
if: ${{ inputs.publish == 'true' && inputs.isRelease == 'true' }}
if: ${{ inputs.publishType == 'release' }}
shell: bash
run: |
echo "Release tag will be: ${{ env.dissolveVersion }}"
echo "Release name will be: ${{ env.dissolveVersion }}"
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.publish == 'true' && inputs.isRelease == 'false' }}
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 (Release)
if: ${{ inputs.publish == 'true' && inputs.isRelease == 'true' }}
- name: Publish on Harbor
if: ${{ inputs.publishType != 'none' }}
shell: bash
run: |
echo "Release tag will be: latest"
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:latest
- name: Publish on Harbor (Continuous)
if: ${{ inputs.publish == 'true' && inputs.isRelease == 'false' }}
shell: bash
run: |
echo "Release tag will be: continuous"
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:continuous
apptainer push packages/dissolve-gui-${{ env.dissolveVersion }}.sif oras://harbor.stfc.ac.uk/isis_disordered_materials/dissolve:${{ inputs.publishType }}
24 changes: 22 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ jobs:
- name: Publish
uses: "./.github/workflows/publish"
with:
isRelease: true
publish: ${{ ! endsWith(github.ref, 'pre') }}
publishType: 'release'
env:
HARBOR_USER: ${{ secrets.HARBOR_USER }}
HARBOR_SECRET: ${{ secrets.HARBOR_SECRET }}
Expand All @@ -100,3 +99,24 @@ jobs:
with:
createPR: ${{ ! endsWith(github.ref, 'pre') }}
releaseVersion: ${{ env.dissolveVersion }}

Web:
needs: [ Package, BuildLinux ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: "./.github/workflows/setup"
- name: Build Website
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 }}
17 changes: 2 additions & 15 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Website Build
name: Test Website Build

on:
pull_request:
Expand Down Expand Up @@ -28,17 +28,4 @@ jobs:
- name: Build Website
uses: "./.github/workflows/website"
with:
isDevelopment: ${{ github.ref_name == 'develop' || github.event_name == 'pull_request' }}
isRelease: ${{ startsWith(github.ref_name, 'release') }}
isLegacy: false
deploy: ${{ github.ref_name == 'develop' || (startsWith(github.ref_name, 'release') && ! endsWith(github.ref_name, 'pre')) }}
env:
HARBOR_USER: ${{ secrets.HARBOR_USER }}
HARBOR_SECRET: ${{ secrets.HARBOR_SECRET }}
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 }}
publishType: 'none'
32 changes: 14 additions & 18 deletions .github/workflows/website/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ name: Website
description: Build and publish website

inputs:
isRelease:
type: boolean
default: false
isDevelopment:
type: boolean
default: false
isLegacy:
type: boolean
default: false
deploy:
type: boolean
default: false
publishType:
type: choice
default: 'none'
options:
- none
- continuous
- release
- legacy
pdfExamples:
type: boolean
default: false
Expand All @@ -27,7 +23,7 @@ runs:
run: sed -i "s/MAJOR.MINOR/${{ env.dissolveMajorVersion }}.${{ env.dissolveMinorVersion }}/g" web/docs.toml

- name: 'Apply Main Release Styling'
if: ${{ inputs.isRelease == 'true' && inputs.isLegacy == 'false' }}
if: ${{ inputs.publishType == 'release' }}
shell: bash
run: |
# Set version and tip visibility in docs index
Expand All @@ -36,7 +32,7 @@ runs:
head -n 10 web/docs/_index.md
- name: 'Apply Development Release Styling'
if: ${{ inputs.isDevelopment == 'true' }}
if: ${{ inputs.publishType == 'continuous' }}
shell: bash
run: |
# Set version and tip visibility in docs index
Expand All @@ -53,7 +49,7 @@ runs:
grep navbar-background-color web/assets/scss/_content.scss
- name: 'Apply Legacy Release Styling'
if: ${{ inputs.isLegacy == 'true' }}
if: ${{ inputs.publishType == 'legacy' }}
shell: bash
run: |
# Set version and tip visibility in docs index
Expand Down Expand Up @@ -131,7 +127,7 @@ runs:
done
- name: 'SSH Deploy to Server (Release) (Docs only)'
if: ${{ inputs.deploy == 'true' && inputs.isRelease == 'true' && inputs.isLegacy == 'false' }}
if: ${{ inputs.publishType == 'release' }}
shell: bash
run: |
echo "${SERVER_ID}" > ./serverId
Expand All @@ -140,7 +136,7 @@ runs:
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.deploy == 'true' && inputs.isLegacy == 'true' }}
if: ${{ inputs.publishType == 'legacy' }}
shell: bash
run: |
echo "${SERVER_ID}" > ./serverId
Expand All @@ -149,7 +145,7 @@ runs:
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 (Development)'
if: ${{ inputs.deploy == 'true' && inputs.isDevelopment == 'true' }}
if: ${{ inputs.publishType == 'continuous' }}
shell: bash
run: |
echo "${SERVER_ID}" > ./serverId
Expand Down

0 comments on commit fe4da06

Please sign in to comment.