Created
October 30, 2018 16:53
-
-
Save 256BitChris/de10c2f3d85b65000f2a96ef549d261b to your computer and use it in GitHub Desktop.
Example BitBucket Pipeline YML file for Maven Projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: atlassian/default-image:2 | |
pipelines: | |
branches: | |
master: # Trigger this for any pushes to the master branch. | |
- step: | |
name: Build and Deploy Snapshot Artifact | |
trigger: automatic | |
caches: | |
- maven # Cache any dependencies we download, speeds up build times. | |
script: | |
- bash create-settings.sh # Create our settings.xml file. Will fail if environment variables aren't set properly. | |
- mvn -B verify # Ensure all artifacts build successfully before we attempt deploy in order to prevent partial deploys. | |
- mvn -B -s settings.xml deploy # Now that all builds have completed, we can deploy all the artifacts. | |
- step: | |
name: Create Release Version # This will create a release version and commit it to master. It will then be picked up and deployed in the first step. | |
trigger: manual | |
caches: | |
- maven | |
script: | |
- bash create-settings.sh # Create our settings.xml file. Will fail if environment variables aren't set properly. | |
- bash validate-release-configuration.sh # Do the best we can to ensure we have the SSH keys and env variables in place before we try to prepare a release. | |
- git config --global user.email "$GIT_USER_EMAIL" | |
- git config --global user.name "$GIT_USER_NAME" | |
- mvn -B -DdryRun=true release:prepare # Ensure that most things will run properly before we do the real work. | |
- mvn -B release:clean release:prepare # This bumps the versions in the poms, creates new commits, which will then get built by the master branch trigger. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to run