Skip to content

Commit

Permalink
Merge branch 'master' into 48858_imp_millores_diverses
Browse files Browse the repository at this point in the history
  • Loading branch information
polsala authored Oct 5, 2023
2 parents 71ab5a6 + fc3f6fd commit f99be5e
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 10 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/deploy_branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy branches

on:
push:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

env:
HOME: /home/ci_repos
SCRIPTS_PATH: /home/ci_repos/ci_scripts
USER: ci_repos

permissions:
actions: write
checks: write
contents: write
deployments: write
issues: write
pull-requests: write
repository-projects: write
statuses: read

jobs:
deploy:
runs-on: [self-hosted, Keroberos]
steps:
- uses: actions/checkout@v4
- name: Update packages
run: |
. $SCRIPTS_PATH/load_pyenv.sh
pyenv activate deploy
pip install --upgrade apply_pr
pip install --upgrade giscemultitools
- name: Get projects and commits info
env:
GITHUB_TOKEN: ${{ secrets.RO_GH_ACTIONS_TOKEN }}
run: |
. $SCRIPTS_PATH/load_pyenv.sh
pyenv activate deploy
echo 'PROJECTS_INFO<<EOF' >> $GITHUB_ENV
gisce_github get-commits-sha-from-merge-commit --owner ${{ github.repository_owner }} --repository ${{ github.event.repository.name }} --sha ${{ github.sha }} >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Deploy PR
env:
WORKSPACE: ${{github.workspace}}/..
GITHUB_TOKEN: ${{github.token}}
APPLY_PR_NO_SUDO_MODE: 1
run: |
. $SCRIPTS_PATH/load_pyenv.sh
pyenv activate deploy
git config user.name Release Bot
git config user.email [email protected]
pr_number=$( echo '${{ env.PROJECTS_INFO }}' | jq -r '.pullRequest.number' )
pr_url=$( echo '${{ env.PROJECTS_INFO }}' | jq -r '.pullRequest.url' )
pr_title=$( echo '${{ env.PROJECTS_INFO }}' | jq -r '.pullRequest.title' )
pr_base_branch=$( echo '${{ env.PROJECTS_INFO }}' | jq -r '.pullRequest.baseRefName' )
ex_code=0
for row in $( echo '${{ env.PROJECTS_INFO }}' | jq -r '.projectItems[] | @base64' ); do
_jq() {
echo "${row}" | base64 --decode | jq -r "${1}"
}
done_opt=$(_jq '.field_column_options.Done')
error_opt=$(_jq '.field_column_options.Error')
if [[ $(_jq '.card_state') == 'Todo' ]];
then
(git remote set-branches --add origin $(_jq '.project_name') && git fetch origin $(_jq '.project_name') && git checkout $(_jq '.project_name') && (printf '$USER\n' | sastre deploy --host=ssh://$USER@localhost --sudo_user=$USER --src=$WORKSPACE --force-hostname=$(_jq '.project_name') --pr=$pr_number --repository=${{ github.event.repository.name }} --environ test --skip-rolling-check --exit-code-failure --no-set-label) && git push origin $(_jq '.project_name') && (GITHUB_TOKEN=${{ secrets.RO_GH_ACTIONS_TOKEN }} && gisce_github update-projectv2-card-from-id --owner ${{ github.repository_owner }} --repository ${{ github.event.repository.name }} --project-id $(_jq '.project_id') --item-id $(_jq '.card_id') --field-id $(_jq '.field_column_id') --value $done_opt)) || (GITHUB_TOKEN=${{ secrets.RO_GH_ACTIONS_TOKEN }} && gisce_github update-projectv2-card-from-id --owner ${{ github.repository_owner }} --repository ${{ github.event.repository.name }} --project-id $(_jq '.project_id') --item-id $(_jq '.card_id') --field-id $(_jq '.field_column_id') --value $error_opt && gisce_slack slack-notify --hook ${{ secrets.RELEASE_MASTER_WEBHOOK }} --title "Failed release" --icon "🔥" --message "Error deploying: $pr_url Into: https://github.com/${{ github.repository }}/tree/$(_jq '.project_name') Project: $(_jq '.project_url')" --origin "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" && ex_code=1)
fi
done
exit $ex_code
9 changes: 5 additions & 4 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: TESTS_POWEREMAIL_MODULES
name: Run tests

on:
pull_request:
Expand All @@ -20,7 +20,7 @@ env:
jobs:
tests:
if: ${{ (github.event_name == 'pull_request' && github.event.label.name == 'to be merged') }}
runs-on: [self-hosted, Replicante]
runs-on: [self-hosted, Buda]
strategy:
fail-fast: false
matrix:
Expand All @@ -44,7 +44,7 @@ jobs:
with:
path: src/erp
repository: gisce/erp
token: ${{ secrets.MASTER_GH_TOKEN }}
token: ${{ secrets.RO_GITHUB_ACTIONS_REPOS }}

- name: Prepare virtualenv Python ${{ matrix.python-version }}
env:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
id: run_tests
env:
BUILD_ID: ${{ steps.build_id.outputs.id }}
GITHUB_TOKEN: ${{ secrets.MASTER_GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RO_GITHUB_ACTIONS_REPOS }}
ROOT_DIR_SRC: ${{ github.workspace }}/src
ADDONS_PATH: ${{ github.workspace }}/src/erp/server/bin/addons
run: |
Expand Down Expand Up @@ -112,3 +112,4 @@ jobs:
name: "Mergeable"
status: "${{ steps.run_tests.outcome }}"
url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"

2 changes: 1 addition & 1 deletion poweremail_auth/__terp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "Gestión de API's",
"description": """Añade EP's de poweremail API""",
"version": "0-dev",
"version": "23.9.0",
"author": "GISCE",
"category": "Misc",
"depends": [
Expand Down
2 changes: 1 addition & 1 deletion poweremail_campaign/__terp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "PowerEmail Campaign",
"description": """PowerEmail Campaign Manager""",
"version": "0-dev",
"version": "23.9.0",
"author": "GISCE",
"category": "GISCEMaster",
"depends": [
Expand Down
2 changes: 1 addition & 1 deletion poweremail_load_templates/__terp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "PowerEmail Campaign",
"description": """PowerEmail Sync Templates""",
"version": "0-dev",
"version": "23.9.0",
"author": "GISCE",
"category": "GISCEMaster",
"depends": [
Expand Down
2 changes: 1 addition & 1 deletion poweremail_oorq/__terp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "Poweremail OORQ",
"description": """Poweremail using OORQ""",
"version": "0.5.1",
"version": "23.9.0",
"author": "GISCE",
"category": "GISCEMaster",
"depends": ['base', 'poweremail', 'oorq'],
Expand Down
2 changes: 1 addition & 1 deletion poweremail_references/__terp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "Poweremail References",
"description": """Poweremail References""",
"version": "0-dev",
"version": "23.9.0",
"author": "GISCE",
"category": "GISCEMaster",
"depends":[
Expand Down
2 changes: 1 addition & 1 deletion poweremail_signaturit/__terp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "Poweremail OORQ",
"description": """Poweremail using OORQ""",
"version": "0.4.1",
"version": "23.9.0",
"author": "GISCE",
"category": "GISCEMaster",
"depends": [
Expand Down

0 comments on commit f99be5e

Please sign in to comment.