Adjust release workflow for new repo
This commit is contained in:
@@ -18,72 +18,23 @@ jobs:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
cache: 'maven'
|
cache: 'maven'
|
||||||
|
# Writes a <server id="smr"> entry to ~/.m2/settings.xml that reads the credentials from these env vars
|
||||||
|
server-id: smr
|
||||||
|
server-username: MAVEN_DEPLOY_USER
|
||||||
|
server-password: MAVEN_DEPLOY_TOKEN
|
||||||
|
|
||||||
- name: Set up Maven
|
- name: Set up Maven
|
||||||
uses: stCarolas/setup-maven@v5
|
uses: stCarolas/setup-maven@v5
|
||||||
with:
|
with:
|
||||||
maven-version: 3.9.6
|
maven-version: 3.9.6
|
||||||
|
|
||||||
- name: Get release version
|
|
||||||
id: get_version
|
|
||||||
run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set version from release tag
|
- name: Set version from release tag
|
||||||
run: mvn -B versions:set -DnewVersion="${{ github.event.release.tag_name }}" -DgenerateBackupPoms=false
|
run: mvn -B versions:set -DnewVersion="${{ github.event.release.tag_name }}" -DgenerateBackupPoms=false
|
||||||
|
|
||||||
- name: Build plugin
|
- name: Build and deploy
|
||||||
run: mvn -B -U -C clean package -DskipTests
|
env:
|
||||||
|
MAVEN_DEPLOY_USER: ${{ vars.MAVEN_DEPLOY_USER }}
|
||||||
- name: Extract Maven coordinates
|
MAVEN_DEPLOY_TOKEN: ${{ secrets.MAVEN_DEPLOY_TOKEN }}
|
||||||
id: meta
|
|
||||||
run: |
|
run: |
|
||||||
echo "groupId=$(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout)" >> $GITHUB_OUTPUT
|
mvn -B -U clean deploy -DskipTests \
|
||||||
echo "artifactId=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_OUTPUT
|
-DaltDeploymentRepository=smr::${{ vars.MAVEN_REPO_URL }}
|
||||||
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Set up SSH
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.MVN_REPO_SSH_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
ssh-keyscan -H ${{ secrets.MVN_REPO_SSH_HOST }} >> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
- name: Generate checksums
|
|
||||||
run: |
|
|
||||||
ARTIFACT_ID=${{ steps.meta.outputs.artifactId }}
|
|
||||||
VERSION=${{ steps.meta.outputs.version }}
|
|
||||||
|
|
||||||
JAR_FILE=target/$ARTIFACT_ID-$VERSION.jar
|
|
||||||
POM_FILE=target/$ARTIFACT_ID-$VERSION.pom
|
|
||||||
|
|
||||||
cp pom.xml $POM_FILE
|
|
||||||
|
|
||||||
for file in $JAR_FILE $POM_FILE; do
|
|
||||||
sha1sum "$file" | awk '{ print $1 }' > "$file.sha1"
|
|
||||||
md5sum "$file" | awk '{ print $1 }' > "$file.md5"
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Upload artifact and checksums to VPS
|
|
||||||
run: |
|
|
||||||
GROUP_PATH=$(echo "${{ steps.meta.outputs.groupId }}" | sed 's/\./\//g')
|
|
||||||
ARTIFACT_ID=${{ steps.meta.outputs.artifactId }}
|
|
||||||
VERSION=${{ steps.meta.outputs.version }}
|
|
||||||
REMOTE_DIR="${{ secrets.REMOTE_MAVEN_PATH }}/$GROUP_PATH/$ARTIFACT_ID/$VERSION"
|
|
||||||
|
|
||||||
echo "Creating remote directory: $REMOTE_DIR"
|
|
||||||
ssh ${{ secrets.MVN_REPO_SSH_USER }}@${{ secrets.MVN_REPO_SSH_HOST }} "mkdir -p $REMOTE_DIR"
|
|
||||||
|
|
||||||
FILES=(
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.jar"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.jar.sha1"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.jar.md5"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.pom"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.pom.sha1"
|
|
||||||
"target/$ARTIFACT_ID-$VERSION.pom.md5"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "Uploading files..."
|
|
||||||
for file in "${FILES[@]}"; do
|
|
||||||
echo "Uploading $file"
|
|
||||||
scp "$file" ${{ secrets.MVN_REPO_SSH_USER }}@${{ secrets.MVN_REPO_SSH_HOST }}:$REMOTE_DIR/
|
|
||||||
done
|
|
||||||
Reference in New Issue
Block a user