Merge branch 'beta' into make_modal_export_better

This commit is contained in:
Alex Williams
2024-07-08 18:56:46 +01:00
committed by GitHub
4 changed files with 140 additions and 7 deletions

86
.github/workflows/autodeploy.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
# This is a basic deployment workflow triggered by pushes to the beta and live branches.
name: Auto-Deploy 'beta/live' Branch to beta.coliolis.io or coriolis.io
# Controls when the action will run. Workflow runs when the alpha branch receives a push event
on:
push:
branches:
- beta
- live
# Figure out the target branch name
env:
BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
TARGET_ZIP: build.zip
BUCKET_FOLDER: build
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: builder
steps:
- name: Download the code
shell: bash
run: |
rm -Rf ./coriolis
rm -Rf ./coriolis-data
git clone https://github.com/Brighter-Applications/coriolis.git --single-branch --branch ${BRANCH_NAME}
git clone https://github.com/Brighter-Applications/coriolis-data.git --single-branch --branch ${BRANCH_NAME}
- name: Build the code
shell: bash
run: |
cd ./coriolis-data
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm install 2>&1
npm start
cd ../coriolis
npm install 2>&1
npm run build 2>&1
- name: Zip the code
shell: bash
run: |
zip -r ./${TARGET_ZIP} ./coriolis/build/*
- name: Authorize GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.CORIOLIS_GCP_SA_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: '>=363.0.0'
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Upload to Google Cloud Storage
run: |-
TARGET_ZIP=${{ env.TARGET_ZIP }}
BUCKET_PATH=${{ secrets.CORIOLIS_GCP_TARGET_BUCKET }}/${{ env.BUCKET_FOLDER }}
EXTENSION="${TARGET_ZIP##*.}"
FILENAME="${TARGET_ZIP%.*}"
LATEST_FILENAME="${FILENAME}_latest.${EXTENSION}"
gsutil cp ./$TARGET_ZIP gs://${BUCKET_PATH}/${LATEST_FILENAME}
deploy:
runs-on: webapp
needs: build
steps:
- name: Authorize GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.CORIOLIS_GCP_SA_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: '>=363.0.0'
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Download and unzip the build
shell: bash
run: |
rm -Rf ./*
EXTENSION="${TARGET_ZIP##*.}"
FILENAME="${TARGET_ZIP%.*}"
LATEST_FILENAME="${FILENAME}_latest.${EXTENSION}"
gsutil cp gs://${{ secrets.CORIOLIS_GCP_TARGET_BUCKET }}/${{ env.BUCKET_FOLDER }}/${LATEST_FILENAME} ${LATEST_FILENAME}
unzip ./${LATEST_FILENAME}
- name: Move the build to the web server
shell: bash
run: |
if [ ${{ env.BRANCH_NAME }} == "beta" ]; then sudo -u www-data cp -r ./coriolis/build/* /var/www/beta.coriolis.io/; else sudo -u www-data cp -r ./coriolis/build/* /var/www/coriolis.io/; fi

46
.github/workflows/manualdeploy.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
# This is a basic manual deployment workflow triggered by pushes to the beta and live branches.
name: Manual-Deploy 'beta/live' Branch to beta.coliolis.io or coriolis.io
# Controls when the action will run. Workflow runs when the alpha branch receives a push event
on:
workflow_dispatch:
# Get the target branch name
inputs:
branch:
type: choice
description: 'Branch Name'
required: true
default: 'beta'
# Only allow beta or live branches
options:
- beta
- live
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Download the code
shell: bash
run: |
rm -Rf ./coriolis
rm -Rf ./coriolis-data
git clone https://github.com/Brighter-Applications/coriolis.git --single-branch --branch ${{ github.events.inputs.branch }}
git clone https://github.com/Brighter-Applications/coriolis-data.git --single-branch --branch ${{ github.events.inputs.branch }}
- name: Build the code
shell: bash
run: |
cd coriolis-data
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm install 2>&1
npm start
cd ../coriolis
npm install 2>&1
npm run build 2>&1
- name: Deploy the code
shell: bash
run: |
cd ../coriolis
if [ ${{ github.events.inputs.branch }} == "beta" ]; then sudo rm -Rf /var/www/beta.coriolis.io/* && sudo -u www-data cp -r ./build/* /var/www/beta.coriolis.io/; else sudo rm -Rf /var/www/coriolis.io/* && sudo -u www-data cp -r ./build/* /var/www/coriolis.io/; fi

View File

@@ -369,13 +369,13 @@ export default class ModalShoppingList extends TranslatedComponent {
&nbsp;|&nbsp;<label>{translate('G5')}</label>
<input id={5} type={'number'} min={0} value={this.state.matsPerGrade[5]} onChange={this.changeHandler} />
</div>
<div>
<p>{translate('PHRASE_ALL_MODULES_ALL_ROLLS')}</p>
<textarea className='cb json' readOnly value={this.state.matsList} />
<p>{translate('PHRASE_FOR_FINER_CONTROL')}</p>
</div>
<p hidden={compatible} id={'browserbad'} className={'l'}>{translate('PHRASE_FIREFOX_EDENGINEER')}</p>
<p hidden={!this.state.failed} id={'failed'} className={'l'}>{translate('PHRASE_FAILED_TO_FIND_EDENGINEER')}</p>
<div id='edengineer' display={this.display} hidden={!!this.state.failed && !compatible}>
<hr />
<h3>ED Engineer</h3>

View File

@@ -5,6 +5,7 @@ const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { InjectManifest } = require('workbox-webpack-plugin');
const { max } = require('lodash');
module.exports = merge(common, {
// devtool: 'source-map',
@@ -18,9 +19,9 @@ module.exports = merge(common, {
plugins: [
new CopyWebpackPlugin({
patterns: [
'src/.htaccess',
'src/iframe.html',
'src/xdLocalStoragePostMessageApi.min.js',
'src/.htaccess',
'src/iframe.html',
'src/xdLocalStoragePostMessageApi.min.js',
{ from: 'src/schemas', to: 'schemas' },
{
from: 'src/images/logo/*',
@@ -42,11 +43,11 @@ module.exports = merge(common, {
// overwrite: true,
// appVersion: `${pkgJson.version}-${buildDate.toISOString()}`
// }),
new InjectManifest({
swSrc: './src/sw.js',
swDest: 'service-worker.js'
}),
]
});