Skip to content

2.12.16

2.12.16 #42

name: Publish artifact
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
- name: Set version
id: set-version
run: |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "project-version=$version" >> $GITHUB_OUTPUT
- name: Fetch artifact
id: fetch-artifact
run: |
GROUP_ID=io/jenkins/plugin-management
ARTIFACT_ID=plugin-management-cli
FILE_NAME=jenkins-plugin-manager
PROJECT_VERSION=${{ steps.set-version.outputs.project-version }}
echo $PROJECT_VERSION
echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
SHA256SUM=$(curl -fsSL https://repo.jenkins-ci.org/releases/$GROUP_ID/$ARTIFACT_ID/$PROJECT_VERSION/$ARTIFACT_ID-$PROJECT_VERSION.jar.sha256)
echo "${SHA256SUM} $FILE_NAME-$PROJECT_VERSION.jar" >$FILE_NAME-$PROJECT_VERSION.jar.sha256
wget -q https://repo.jenkins-ci.org/releases/$GROUP_ID/$ARTIFACT_ID/$PROJECT_VERSION/$ARTIFACT_ID-$PROJECT_VERSION.jar \
-O $FILE_NAME-$PROJECT_VERSION.jar \
&& sha256sum -c --strict $FILE_NAME-$PROJECT_VERSION.jar.sha256
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
${{ steps.fetch-artifact.outputs.file-name }}-${{ steps.set-version.outputs.project-version }}.jar
${{ steps.fetch-artifact.outputs.file-name }}-${{ steps.set-version.outputs.project-version }}.jar.sha256