Skip to content

Instantly share code, notes, and snippets.

@brilvio
Created March 8, 2018 16:57
Show Gist options
  • Save brilvio/459bedd08d027aef559a0aaaa25b2d1d to your computer and use it in GitHub Desktop.
Save brilvio/459bedd08d027aef559a0aaaa25b2d1d to your computer and use it in GitHub Desktop.
stages:
- build
teste:
stage: build
environment:
name: staging
script:
- SET NOMEARQ=DB120_RELEASE_R03.03
- cd Base
- git fetch -p
- git log --reverse --format="" --name-only --relative origin/manutencao..HEAD > diff.txt
- SETLOCAL EnableDelayedExpansion
- for /f "Tokens=* Delims=" %%x in (diff.txt) do set FILES=!FILES! + ..\Base\%%x
- SET files=%NOMEARQ%.sql%FILES%
- cd ..
- cd 120.03
- copy /b %FILES% %NOMEARQ%.sql
- cd ..
- CompileUpdt.exe auto
artifacts:
name: "%CI_PROJECT_NAME%_%CI_BUILD_NAME%_%CI_BUILD_REF_NAME%_%CI_BUILD_ID%"
paths:
- UpdateXpert.exe
- Updateinst.xpt
expire_in: 2 week
when: always
expire_in: 2 week
except:
- manutencao
production:
type: build
environment:
name: production
script:
- git remote set-url origin "http://gitlab-ci-token:%CI_TAG_UPLOAD_TOKEN%@gitlab.xpertgit.com/BaseDeDados/teste.git"
- SET NOMEARQ=DB120_RELEASE_R03.03
- cd Base
- git fetch -p
- git checkout manutencao
- git log --reverse --format="" --name-only --relative HEAD~1..HEAD > diff.txt
- SETLOCAL EnableDelayedExpansion
- for /f "Tokens=* Delims=" %%x in (diff.txt) do set FILES=!FILES! + ..\Base\%%x
- SET files=%NOMEARQ%.sql%FILES%
- cd ..
- cd 120.03
- copy /b %FILES% %NOMEARQ%.sql
- git add %NOMEARQ%.sql
- git commit -m "[ci skip] update automatico"
- git push origin manutencao
- cd ..
- CompileUpdt.exe auto
artifacts:
name: "%CI_PROJECT_NAME%_%CI_BUILD_NAME%_%CI_BUILD_REF_NAME%_%CI_BUILD_ID%"
paths:
- UpdateXpert.exe
- Updateinst.xpt
expire_in: 2 week
when: always
expire_in: 2 week
only:
- manutencao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment