Skip to content

Commit

Permalink
Added github workflow for mirroring release artifacts (#387)
Browse files Browse the repository at this point in the history
* Added github release action file

This is to mirror Jenkinsfile Runner releases to GitHub Releases

* formatted yaml doc

* removed adding source jar to release assets
  • Loading branch information
babusekaran committed Oct 10, 2020
1 parent 49e4874 commit afba6ed
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/publish-release-artifact.yml
@@ -0,0 +1,55 @@
name: Publish artifact

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set version
id: set-version
run: |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "::set-output name=project-version::$version"
echo "::set-env name=PROJECT_VERSION::$version"
- run: echo $PROJECT_VERSION
- name: Fetch artifact
id: fetch-artifact
run: |
GROUP_ID=io/jenkins/jenkinsfile-runner
ARTIFACT_ID=jenkinsfile-runner
FILE_NAME=jenkinsfile-runner
PROJECT_VERSION=${{ steps.set-version.outputs.project-version }}
echo "::set-output name=file-name::$FILE_NAME"
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
wget -q https://repo.jenkins-ci.org/releases/$GROUP_ID/$ARTIFACT_ID/$PROJECT_VERSION/$ARTIFACT_ID-$PROJECT_VERSION.zip \
-O $FILE_NAME-$PROJECT_VERSION.zip
- name: Upload artifact uber jar
id: upload-artifact-uber-jar
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.fetch-artifact.outputs.file-name }}-${{ steps.set-version.outputs.project-version }}.jar
asset_name: ${{ steps.fetch-artifact.outputs.file-name }}-${{ steps.set-version.outputs.project-version }}.jar
asset_content_type: application/java-archive
- name: Upload artifact minimum package
id: upload-artifact-minimum-package
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ steps.fetch-artifact.outputs.file-name }}-${{ steps.set-version.outputs.project-version }}.zip
asset_name: ${{ steps.fetch-artifact.outputs.file-name }}-${{ steps.set-version.outputs.project-version }}.zip
asset_content_type: application/zip

0 comments on commit afba6ed

Please sign in to comment.