Created
April 11, 2023 18:02
-
-
Save mrts/71a66ccbb04b856d0a3fc132800fb04c to your computer and use it in GitHub Desktop.
Deploy a Maven package to GitLab Packages
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
cat << 'EOF' > gitlab-mvn-settings.xml | |
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"> | |
<servers> | |
<server> | |
<id>gitlab</id> | |
<configuration> | |
<httpHeaders> | |
<property> | |
<name>Deploy-Token</name> | |
<value>${env.GITLAB_DEPLOY_TOKEN}</value> | |
</property> | |
</httpHeaders> | |
</configuration> | |
</server> | |
</servers> | |
</settings> | |
EOF | |
export GITLAB_DEPLOY_TOKEN='your GitLab deploy token' | |
mvn -s gitlab-mvn-settings.xml deploy # use --batch-mode in a CI job |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment