Skip to content

Instantly share code, notes, and snippets.

@64BitChris
Created October 30, 2018 16:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save 64BitChris/de10c2f3d85b65000f2a96ef549d261b to your computer and use it in GitHub Desktop.
Save 64BitChris/de10c2f3d85b65000f2a96ef549d261b to your computer and use it in GitHub Desktop.
Example BitBucket Pipeline YML file for Maven Projects
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.
@mmezgin
Copy link

mmezgin commented Jul 19, 2022

how to run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment