Skip to content

chore(deps): update dependency gradle to v8.8 (#321) #196

chore(deps): update dependency gradle to v8.8 (#321)

chore(deps): update dependency gradle to v8.8 (#321) #196

name: Release Drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
# pull_request_target event is required for autolabeler to support PRs from forks
pull_request_target:
types: [opened, reopened, synchronize]
jobs:
update_release_draft:
# Skip release drafts in forks
if: github.repository_owner == 'vlsi'
name: Update Release Draft
runs-on: ubuntu-latest
env:
# Publish pre-release files to a draft release
PUBLISH_SNAPSHOT: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
# Drafts your next Release notes as Pull Requests are merged into "master"
- name: Update release body draft
uses: release-drafter/release-drafter@v6
id: prepare_release
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout sources
if: ${{ env.PUBLISH_SNAPSHOT }}
uses: actions/checkout@v4
- name: Set up JDK 17
if: ${{ env.PUBLISH_SNAPSHOT }}
uses: actions/setup-java@v4
with:
java-version: 17
distribution: liberica
- name: Build
if: ${{ env.PUBLISH_SNAPSHOT }}
uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk17
arguments: --scan --no-parallel --no-daemon shadowJar
- name: Attach files to release
if: ${{ env.PUBLISH_SNAPSHOT }}
uses: actions/github-script@v7
env:
# https://github.com/release-drafter/release-drafter#action-outputs
RELEASE_ID: ${{ steps.prepare_release.outputs.id }}
with:
# language=JavaScript
script: |
const fs = require('fs');
const {RELEASE_ID} = process.env;
// remove old jar files from the release
const assets = await github.rest.repos.listReleaseAssets({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: RELEASE_ID
});
for (const asset of assets.data) {
if (asset.name.endsWith('-all.jar')) {
await github.rest.repos.deleteReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
asset_id: asset.id
});
}
}
const globber = await glob.create('build/libs/ksar-*-all.jar');
const files = await globber.glob();
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
name: files[0].replace(/^(.*build\/libs\/ksar-)/, "ksar-"),
release_id: RELEASE_ID,
data: fs.readFileSync(files[0])
})