Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions #28

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
a709e40
adding github-actions
Dec 1, 2021
172321a
test adding eslint-disable-next-line
Dec 1, 2021
34d313b
merge and solve conflicts
Dec 1, 2021
ab7aa8b
edit script
Dec 1, 2021
86e3636
changes
Dec 1, 2021
dd893de
undo last change
Dec 1, 2021
fb51304
adding deploy
Dec 15, 2021
17569c1
adding homepage
Dec 15, 2021
9dca133
deleting homepage
Dec 15, 2021
c99065d
adding homepage
Jan 5, 2022
122e82a
fix homepage
Jan 5, 2022
79c81d2
changes workflow
Jan 5, 2022
de93563
fix workflow
Jan 5, 2022
dc1cbf2
fix workflow
Jan 5, 2022
71ea06e
changes workflow
Jan 5, 2022
5865186
changes github-actions
Jan 19, 2022
da6a649
github actions
Jan 19, 2022
29da83d
create deploy folder
Jan 24, 2022
49c8689
fix yml
Jan 24, 2022
7dc3dfe
changes yml
Feb 8, 2022
7a9f22b
disable eslint
Feb 8, 2022
396d861
fix warning
Feb 8, 2022
2299080
merge and solve conflicts
Feb 9, 2022
9ea7838
warning
Feb 9, 2022
3cbf27a
changes yml
Feb 9, 2022
18c2286
changes yml
Feb 9, 2022
a7496ca
changing deploy step
Feb 9, 2022
4818ca5
fix yml
Feb 9, 2022
815b4aa
change step name
Feb 9, 2022
4e639ca
deleting pr delpoy
Feb 9, 2022
0ad7996
adding comments
Feb 9, 2022
6758908
creating deployment job
Feb 15, 2022
18be348
fix secret name
Feb 15, 2022
c956317
changes yml
Feb 15, 2022
820f20c
undo test
Feb 15, 2022
c72d69b
avoid deploy when pull request is created
Mar 2, 2022
11b5560
code clean
Mar 2, 2022
48ea2bb
adding subdirectory
Mar 2, 2022
c7f561f
extract branch name
Mar 9, 2022
3f5f687
fix
Mar 9, 2022
cb89b77
fix
Mar 9, 2022
68bffde
fix yml
Mar 9, 2022
a0609f6
changes extract branch name
Mar 9, 2022
d4bea92
adding branch name logic
Mar 9, 2022
9c5fafd
set branch name
Mar 9, 2022
4ef2c23
fix
Mar 9, 2022
999c034
fix env var
Mar 9, 2022
e6a9319
testing main deploy
Mar 16, 2022
e072922
testing main deploy
Mar 16, 2022
e733fa5
undo test
Mar 16, 2022
a278f46
delete deployments
Mar 22, 2022
2dc8d5d
fix branch name
Mar 22, 2022
04badec
set url
Mar 23, 2022
f164d71
adding artifact name depending on the branch
Mar 28, 2022
857ac63
deleting artifacts
Mar 28, 2022
26ab024
code clean
Mar 28, 2022
92f277e
deleting optional arguments
Mar 28, 2022
a606391
changes
Mar 30, 2022
70880fb
fix branch name on pr
Mar 30, 2022
2adbb09
fix name branch
Mar 30, 2022
a18ff61
test name branch
Mar 30, 2022
5ecadba
.
Mar 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build & deploy

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
name: Build
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run code style check
run: npm run lint
- name: Run code formatter
run: npm run prettier
- name: Build
run: npm run build --if-present
- name: Create deploy folder
run: mkdir deploy
- name: Copy content from build folder to deploy folder
run: cp -r ./build/. ./deploy
- name: Copy content from public folder to deploy folder
run: cp -r ./public/. ./deploy
- name: Add script tag into index.html
run: sed -i '4 i <script src="./direflowBundle.js"></script>' './deploy/index.html'
- name: Upload production-ready build files on main branch
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v2
with:
name: production-files
path: ./deploy
- name: Upload production-ready build files on pull_request
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v2
with:
name: pull-request-files
path: ./deploy

deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: https://simtlix.github.io/simfinity-web/${{ env.branch_name }}
steps:

# save branch name on main branch.
- name: Save branch name on main branch
if: github.event_name != 'pull_request'
run: echo "branch_name=${{ github.head_ref }}" >> $GITHUB_ENV
id: extract_branch

# save branch name on pull request
- name: Save branch name on pull request
if: github.event_name == 'pull_request'
run: echo "branch_name=${{ github.head_ref }}" >> $GITHUB_ENV

- name: Download artifact on main branch
if: github.event_name != 'pull_request'
uses: actions/download-artifact@v2
with:
name: production-files
path: ./deploy
- name: Download artifact on pull_request
if: github.event_name == 'pull_request'
uses: actions/download-artifact@v2
with:
name: pull-request-files
path: ./deploy
- name: Deploy to gh-pages on main branch
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }}
publish_dir: ./deploy
destination_dir: ${{ env.branch_name }}
keep_files: true
- name: Deploy to gh-pages on pull_request
if: github.event_name == 'pull_request'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.ACTIONS_DEPLOY_ACCESS_TOKEN }}
publish_dir: ./deploy
destination_dir: ${{ env.branch_name }}
keep_files: false
125 changes: 125 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"version": "1.0.0",
"author": "Multiscreen Technology Group - SimTLiX SRL",
"license": "SEE LICENSE IN LICENSE",
"homepage": "https://simtlix.github.io/simfinity-web/",
"repository": {
"type": "git",
"url": "https://github.com/simtlix/simfinity-web"
Expand All @@ -13,6 +14,8 @@
"build"
],
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d deploy",
"start": "direflow-scripts start",
"build": "direflow-scripts build",
"build:lib": "direflow-scripts build:lib",
Expand All @@ -28,6 +31,7 @@
"babel-eslint": "^10.1.0",
"direflow-component": "3.5.3",
"direflow-scripts": "3.5.3",
"gh-pages": "^3.2.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-hook-form": "^7.4.0",
Expand Down
13 changes: 13 additions & 0 deletions src/direflow-components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,23 @@ const App = ({ url }) => {
}
});
}, [url]);

useEffect(() => {
// usar useCallBack
const handleClick = (entity, ind) => {
setCurrentEntity(entity);
setResultTitle(
intl.formatMessage({
id: `entity.${entity.name}.plural`,
defaultMessage: `Resultados de ${entity.name}`,
})
);
setSelectedKey(ind.toString());
};
if (entities[0]?.name) {
handleClick(entities[0], 0);
}
// eslint-disable-next-line
}, [entities]);
const handleClick = (entity, ind) => {
setCurrentEntity(entity);
Expand Down
1 change: 1 addition & 0 deletions src/direflow-components/Form/Collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ const Collection = ({
}
);
}
// eslint-disable-next-line
}, [parentId]);

const handleSearch = (selectedKeys, confirm) => {
Expand Down
3 changes: 3 additions & 0 deletions src/direflow-components/Form/FormStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const FormStack = ({ displayEntity = null, onSuccess, mode, id }) => {
return newState;
});
},
// eslint-disable-next-line
[entitiesStack, openForResultForms]
);

Expand Down Expand Up @@ -120,6 +121,7 @@ const FormStack = ({ displayEntity = null, onSuccess, mode, id }) => {
}
});
}
// eslint-disable-next-line
}, []);

const onSubmit = (data, name) => {
Expand Down Expand Up @@ -198,6 +200,7 @@ const FormStack = ({ displayEntity = null, onSuccess, mode, id }) => {
</InstancesContext.Provider>
</FormAntd.Provider>
);
// eslint-disable-next-line
}, [entitiesStack]);

return render();
Expand Down
5 changes: 4 additions & 1 deletion src/direflow-components/Form/SelectEntities.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const SelectEntities = ({
setResponseEntity(data);
});
}
// eslint-disable-next-line
}, [initialValue, initialValueFromForm]);

useEffect(() => {
Expand Down Expand Up @@ -166,8 +167,8 @@ export const SelectEntities = ({
setResponseEntity(data);
});
//}
// eslint-disable-next-line
}, [selectValues]);

const renderSelect = useCallback(() => {
const options = responseEntity?.map((item) => {
return (
Expand All @@ -177,6 +178,7 @@ export const SelectEntities = ({
);
});
return options;
// eslint-disable-next-line
}, [responseEntity]);

// siempre se va a mandar el id como field en este tipo de conexion ?
Expand Down Expand Up @@ -233,6 +235,7 @@ export const SelectEntities = ({
</Space>
</FormAntd.Item>
);
// eslint-disable-next-line
}, [responseEntity, initialValue, initialValueFromForm]);

return element();
Expand Down
Loading