|
| 1 | +name: Upload Artifact as GitHub Release Attachment |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + upload: |
| 9 | + name: Upload |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + |
| 19 | + - name: Cache Local Maven Repository |
| 20 | + uses: actions/cache@v4 |
| 21 | + with: |
| 22 | + path: ~/.m2/repository |
| 23 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 24 | + |
| 25 | + - name: Setup Java |
| 26 | + uses: actions/setup-java@v4 |
| 27 | + with: |
| 28 | + java-version: 17 |
| 29 | + distribution: 'adopt' |
| 30 | + |
| 31 | + - name: Prepare RPM GPG signing |
| 32 | + run: | |
| 33 | + sudo apt-get install expect pinentry-tty; |
| 34 | + printf "RPM_SIGNING_KEYNAME=%q\n" "$(echo "${{ secrets.RPM_SIGNING_PUBLIC_KEY }}" | gpg --show-keys --with-colons | awk -F':' '/uid/{print $10}')" >> $GITHUB_ENV; |
| 35 | + echo "${{ secrets.RPM_SIGNING_PRIVATE_KEY }}" | gpg --batch --import; |
| 36 | + echo "%_gpg_sign_cmd_extra_args --pinentry-mode loopback --passphrase \"%{getenv:RPM_SIGNING_PASSPHRASE}\"" >> "${HOME}/.rpmmacros"; |
| 37 | +
|
| 38 | + - name: Build a jar and rpm for release |
| 39 | + run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean package && cd rpm/ && mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= -f rpm.pom.xml package |
| 40 | + env: |
| 41 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + RPM_SIGNING_KEYNAME: ${{ env.RPM_SIGNING_KEYNAME }} |
| 43 | + RPM_SIGNING_PASSPHRASE: ${{ secrets.RPM_SIGNING_PASSPHRASE }} |
| 44 | + |
| 45 | + - name: Attach rpm to release |
| 46 | + uses: softprops/action-gh-release@v2 |
| 47 | + with: |
| 48 | + files: rpm/target/rpm/com.teragrep-cfe_16/RPMS/noarch/com.teragrep-cfe_16-*.rpm |
| 49 | + |
| 50 | + - uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: artifact |
| 53 | + path: rpm/target/rpm/com.teragrep-cfe_16/RPMS/noarch/com.teragrep-cfe_16-*.rpm |
| 54 | + |
| 55 | + - name: Update pkg_01 releases repository |
| 56 | + |
| 57 | + with: |
| 58 | + from_repository: "${{ github.repository }}" |
| 59 | + from_version: "${{ github.event.release.tag_name }}" |
| 60 | + to_repository: "${{ github.repository_owner }}/pkg_01" |
| 61 | + deploy_key: ${{ secrets.PKG_01_DEPLOY_KEY }} |
| 62 | + files: rpm/target/rpm/com.teragrep-cfe_16/RPMS/noarch/com.teragrep-cfe_16-*.rpm |
| 63 | + gpg_public_key: "${{ secrets.RPM_SIGNING_PUBLIC_KEY }}" |
| 64 | + repo_baseurl: "${{ vars.PKG_01_CENTRAL_BASEURL }}" |
| 65 | + location_prefix: "${{ vars.PKG_01_LOCATION_PREFIX }}" |
| 66 | + env: |
| 67 | + has_deploy_key: ${{ secrets.PKG_01_DEPLOY_KEY != '' }} |
| 68 | + if: ${{ env.has_deploy_key == 'true' }} |
0 commit comments