| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- name: Publish artifact
- on:
- release:
- types: [published]
- permissions:
- contents: read # to fetch code (actions/checkout)
- jobs:
- determine-version:
- if: ${{ github.repository_owner == 'jenkinsci' }}
- runs-on: ubuntu-latest
- outputs:
- project-version: ${{ steps.set-version.outputs.project-version }}
- is-lts: ${{ steps.set-version.outputs.is-lts }}
- is-rc: ${{ steps.set-version.outputs.is-rc }}
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- - name: Set up JDK 21
- uses: actions/setup-java@1d018f9b8b9b505bb578a83b230fabcce01af93b #v 5.0.0
- with:
- distribution: "temurin"
- java-version: 25
- cache: "maven"
- - name: Set version
- id: set-version
- run: |
- version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
- dot_count=$(echo $version | sed 's/[^.]//g' | awk '{ print length }')
- if [ "${dot_count}" = '2' ]
- then
- is_lts=true
- else
- is_lts=false
- fi
- is_rc=false
- if [[ ${version} == *"-SNAPSHOT" ]]; then
- is_rc=true
- fi
- echo "Version is $version, is_lts: $is_lts, is_rc: $is_rc"
- echo "is-lts=${is_lts}" >> $GITHUB_OUTPUT
- echo "project-version=$version" >> $GITHUB_OUTPUT
- echo "is-rc=${is_rc}" >> $GITHUB_OUTPUT
- war:
- permissions:
- contents: write # to upload release asset (softprops/action-gh-release)
- runs-on: ubuntu-latest
- needs: determine-version
- if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
- steps:
- - name: Fetch war
- id: fetch-war
- run: |
- FILE_NAME=jenkins.war
- PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
- IS_LTS=${{ needs.determine-version.outputs.is-lts }}
- echo $PROJECT_VERSION
- echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
- echo "signature-file-name=${FILE_NAME}.asc" >> $GITHUB_OUTPUT
- REPO=war
- if [ ${IS_LTS} = 'true' ]
- then
- REPO=war-stable
- fi
- echo $REPO
- wget -q https://get.jenkins.io/${REPO}/${PROJECT_VERSION}/${FILE_NAME}
- wget -q https://get.jenkins.io/${REPO}/${PROJECT_VERSION}/${FILE_NAME}.asc
- - name: Upload Release Asset
- id: upload-war
- uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: |
- ${{ steps.fetch-war.outputs.file-name }}
- ${{ steps.fetch-war.outputs.signature-file-name }}
- debian:
- permissions:
- contents: write # to upload release asset (softprops/action-gh-release)
- runs-on: ubuntu-latest
- needs: determine-version
- if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
- steps:
- - name: Fetch Deb
- id: fetch-deb
- if: always()
- run: |
- PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
- echo $PROJECT_VERSION
- FILE_NAME=jenkins_${PROJECT_VERSION}_all.deb
- IS_LTS=${{ needs.determine-version.outputs.is-lts }}
- echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
- REPO=debian
- if [ ${IS_LTS} = 'true' ]
- then
- REPO=debian-stable
- fi
- echo $REPO
- wget -q https://get.jenkins.io/${REPO}/${FILE_NAME}
- - name: Upload Release Asset
- id: upload-deb
- if: always()
- uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: ${{ steps.fetch-deb.outputs.file-name }}
- rpm:
- permissions:
- contents: write # to upload release asset (softprops/action-gh-release)
- runs-on: ubuntu-latest
- needs: determine-version
- if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
- steps:
- - name: Fetch RPM
- id: fetch-rpm
- if: always()
- run: |
- PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
- echo $PROJECT_VERSION
- FILE_NAME=jenkins-${PROJECT_VERSION}-1.noarch.rpm
- IS_LTS=${{ needs.determine-version.outputs.is-lts }}
- echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
- REPO=rpm
- if [ ${IS_LTS} = 'true' ]
- then
- REPO=rpm-stable
- fi
- echo $REPO
- wget -q https://get.jenkins.io/${REPO}/${FILE_NAME}
- - name: Upload Release Asset
- id: upload-rpm
- if: always()
- uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: ${{ steps.fetch-rpm.outputs.file-name }}
- windows:
- permissions:
- contents: write # to upload release asset (softprops/action-gh-release)
- runs-on: ubuntu-latest
- needs: determine-version
- if: ${{ needs.determine-version.outputs.is-rc == 'false' }}
- steps:
- - name: Fetch MSI
- id: fetch-msi
- if: always()
- run: |
- PROJECT_VERSION=${{ needs.determine-version.outputs.project-version }}
- echo $PROJECT_VERSION
- FILE_NAME=jenkins.msi
- IS_LTS=${{ needs.determine-version.outputs.is-lts }}
- echo "file-name=$FILE_NAME" >> $GITHUB_OUTPUT
- REPO=windows
- if [ ${IS_LTS} = 'true' ]
- then
- REPO=windows-stable
- fi
- echo $REPO
- wget -q https://get.jenkins.io/${REPO}/${PROJECT_VERSION}/${FILE_NAME}
- - name: Upload Release Asset
- id: upload-msi
- if: always()
- uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- files: ${{ steps.fetch-msi.outputs.file-name }}
|