Skip to content
Snippets Groups Projects

Resolve "Put release tag on build step"

Merged Benoît Harrault requested to merge 7-put-release-tag-on-build-step into master
+ 11
15
image: cirrusci/flutter:latest
stages:
- test
- update
- build-debug
- build-release
- release
- deploy
tests:
stage: test
script:
- flutter test
interruptible: true
update:
stage: update
script:
@@ -48,8 +41,8 @@ android:build-debug:
android:build-release:
stage: build-release
# only:
# - master
only:
- master
dependencies:
- android:build-debug
script:
@@ -79,21 +72,24 @@ application:release:
stage: release
image:
name: alpine/git
# only:
# - master
entrypoint: [""]
only:
- master
except:
- tags
dependencies:
- android:build-release
script:
- git config user.email "${GITLAB_USER_EMAIL}"
- git config user.name "${GITLAB_USER_NAME}"
- git remote add release-tag-origin https://oauth2:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}
- git remote set-url origin https://oauth2:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}
- VERSION_FILE="$(find . -name 'gradle.properties' | head -n1)"
- VERSION_NAME="$(grep '^app.versionName=' "${VERSION_FILE}" | cut -d'=' -f2)"
- VERSION_CODE="$(grep '^app.versionCode=' "${VERSION_FILE}" | cut -d'=' -f2)"
- TAG_NAME="Release_${VERSION_NAME}_${VERSION_CODE}"
- TAG_NAME="Release_${VERSION_CODE}_${VERSION_NAME}"
- echo "${TAG_NAME}"
# - git tag -a "Release_$(date +%Y-%m-%d)" -m "Auto-Release"
# - git push release-tag-origin "Release_$(date +%Y-%m-%d)"
- git tag -a "${TAG_NAME}" -m "Release ${VERSION_NAME} (${VERSION_CODE})"
- git push origin "${TAG_NAME}"
android:deploy:
stage: deploy
Loading