63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
.gitlab-move-files:
|
|
image: registry.internal.durp.info/debian:latest
|
|
script:
|
|
# Begin of movefiles.sh
|
|
- |
|
|
#move files to output
|
|
mkdir $CI_PROJECT_DIR/output
|
|
for i in $(echo $PROJECT_NAME | tr ";" "\n");
|
|
do mkdir $CI_PROJECT_DIR/output/$i;
|
|
cp -r $CI_PROJECT_DIR/$i $CI_PROJECT_DIR/output/;
|
|
done
|
|
# End of movefiles.sh
|
|
artifacts:
|
|
expire_in: 1 hour
|
|
paths:
|
|
- $CI_PROJECT_DIR/output
|
|
.gitlab-deploy:
|
|
stage: deploy
|
|
image: mcr.microsoft.com/powershell:latest
|
|
script:
|
|
# Begin of update-chart.sh
|
|
- |
|
|
pwsh -c "Install-Module -Name powershell-yaml -Confirm:\$false -Force
|
|
\$template = (Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN'= \$ENV:GITLAB_TOKEN } -Uri \"https://gitlab.com/api/v4/projects/45028985/repository/files/durpapi%2FChart.yaml/raw?ref=main\") | ConvertFrom-Yaml
|
|
\$template.version = \$ENV:VERSION
|
|
\$body = @{
|
|
branch = \"main\"
|
|
commit_message = \"Update Chart\"
|
|
content = \"\$(\$template | convertto-yaml)\"
|
|
} | ConvertTo-Json
|
|
Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN'= \$ENV:GITLAB_TOKEN } -ContentType \"application/json\" -Method Put -body \$body -Uri \"https://gitlab.com/api/v4/projects/45028985/repository/files/durpapi%2FChart.yaml\""
|
|
# End of update-chart.sh
|
|
environment:
|
|
name: production
|
|
url: https://api.durp.info/goapi
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ '/^release/'
|
|
when: manual
|
|
needs:
|
|
- job: version
|
|
artifacts: true
|
|
.generate-config:
|
|
stage: build
|
|
needs:
|
|
- job: version
|
|
artifacts: true
|
|
script:
|
|
# Begin of create-environment.sh
|
|
- |
|
|
#test deployment
|
|
echo "
|
|
$VERSION:
|
|
stage: deploy
|
|
script:
|
|
- echo \"Deploy to staging server\"
|
|
environment:
|
|
name: $ENVIRONMENT
|
|
" > generated-config.yml
|
|
# End of create-environment.sh
|
|
artifacts:
|
|
paths:
|
|
- generated-config.yml
|