Skip to content
Snippets Groups Projects
Commit d1871ccb authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Split tag and publish CI/CD steps

parent 512d0905
No related branches found
No related tags found
1 merge request!23Resolve "Split tag and publish CI/CD steps"
Pipeline #7606 passed
image: ghcr.io/cirruslabs/flutter:latest image: ghcr.io/cirruslabs/flutter:latest
stages: stages:
- build-debug - publish-check
- release - release-tag
- release-publish
android:build-debug: # Check flutter package
stage: build-debug package:publish-check:
stage: publish-check
except: except:
- tags - tags
- master - master
script: script:
# Check flutter package
- VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2)" - VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2)"
- echo "${VERSION_NAME}" - echo "${VERSION_NAME}"
- TAG_NAME="${VERSION_NAME}" - TAG_NAME="${VERSION_NAME}"
...@@ -24,15 +25,20 @@ android:build-debug: ...@@ -24,15 +25,20 @@ android:build-debug:
- flutter pub publish --dry-run - flutter pub publish --dry-run
interruptible: true interruptible: true
application:release: # Create git tag on new release
stage: release package:release-tag:
stage: release-tag
image:
name: alpine/git
entrypoint: [""]
only: only:
- master - master
except: except:
- tags - tags
dependencies: dependencies:
- android:build-debug - package:publish-check
script: script:
- apk --no-cache add curl
- git config user.email "${GITLAB_USER_EMAIL}" - git config user.email "${GITLAB_USER_EMAIL}"
- git config user.name "${GITLAB_USER_NAME}" - git config user.name "${GITLAB_USER_NAME}"
- git remote set-url 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}
...@@ -46,9 +52,24 @@ application:release: ...@@ -46,9 +52,24 @@ application:release:
else else
git tag -a "${TAG_NAME}" -m "Release ${VERSION_NAME}" git tag -a "${TAG_NAME}" -m "Release ${VERSION_NAME}"
git push origin "${TAG_NAME}" git push origin "${TAG_NAME}"
flutter clean
flutter packages get
echo "${PRIVATE_PACKAGES_REPOSITORY_KEY}" | flutter pub token add https://pub.harrault.fr
flutter pub publish --force
curl --silent -d "{\"token\": \"${JABBER_NOTIFICATION_TOKEN}\", \"message\": \"New tag for ${CI_PROJECT_PATH}: ${TAG_NAME}\"}" -H "Content-Type: application/json" -X POST ${JABBER_NOTIFICATION_URL} curl --silent -d "{\"token\": \"${JABBER_NOTIFICATION_TOKEN}\", \"message\": \"New tag for ${CI_PROJECT_PATH}: ${TAG_NAME}\"}" -H "Content-Type: application/json" -X POST ${JABBER_NOTIFICATION_URL}
fi fi
# Publish package to private repository
package:release-publish:
stage: release-publish
only:
- master
except:
- tags
dependencies:
- package:release-tag
script:
- echo "${PRIVATE_PACKAGES_REPOSITORY_KEY}" | flutter pub token add https://pub.harrault.fr
- VERSION_NAME="$(grep '^version:' pubspec.yaml | cut -d' ' -f2)"
- echo "${VERSION_NAME}"
- flutter clean
- flutter packages get
- flutter pub publish --force
- >
curl --silent -d "{\"token\": \"${JABBER_NOTIFICATION_TOKEN}\", \"message\": \"New package published for ${CI_PROJECT_PATH}: ${VERSION_NAME}\"}" -H "Content-Type: application/json" -X POST ${JABBER_NOTIFICATION_URL}
## 1.0.3
- Split tag and publish CI/CD steps, minor CI/CD improvements
## 1.0.2 ## 1.0.2
- Fix publish to private repository - Fix publish to private repository
......
...@@ -3,7 +3,7 @@ description: "Flutter custom toolbox for org.benoitharrault.* projects." ...@@ -3,7 +3,7 @@ description: "Flutter custom toolbox for org.benoitharrault.* projects."
publish_to: https://pub.harrault.fr/ publish_to: https://pub.harrault.fr/
version: 1.0.2 version: 1.0.3
homepage: https://git.harrault.fr/android/flutter-toolbox homepage: https://git.harrault.fr/android/flutter-toolbox
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment