release artifacts #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: artifacts | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- created | |
jobs: | |
artifacts: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: confirm tested | |
id: confirmTested | |
uses: actions/[email protected] | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
# TODO: combine unit, acceptance, integration, reference tests before creating artifacts. also ensure absence of any failed statii | |
script: | | |
const { data: { statuses } } = await github.rest.repos.getCombinedStatusForRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: context.sha, | |
}); | |
console.log(statuses); | |
const anyFailure = statuses.find(( { state }) => state === 'failure'); | |
console.log(anyFailure); | |
const anyPending = statuses.find(( { state }) => state === 'pending'); | |
console.log(anyPending); | |
const prePRWorkflow = statuses.find(({ context }) => context === 'pre-review'); | |
console.log(prePRWorkflow); | |
const acceptTests = statuses.find(({context}) => context === 'acceptance-tests'); | |
console.log(acceptTests); | |
const intTests = statuses.find(({context}) => context === 'integration-tests'); | |
console.log(intTests); | |
const refTests = statuses.find(({context}) => context === 'reference-tests'); | |
console.log(refTests); | |
const { data: reviews } = await github.pulls.listReviews({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number, | |
}); | |
const approvingReviews = reviews.filter(review => review.state === 'APPROVED'); | |
return prePRWorkflow && prePRWorkflow.state === 'success' && | |
acceptTests && acceptTests.state === 'success' && | |
intTests && intTests.state === 'success' && | |
refTests && refTests.state === 'success' && | |
!anyFailure && !anyPending && (approvingReviews.length > 0); | |
- name: Abort on missing status | |
if: steps.confirmTested.outputs.result == 'false' | |
run: | | |
echo "::error::required status missing" | |
exit 1 | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: setup gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: assemble distributions | |
run: ./gradlew assemble -Dorg.gradle.parallel=true -Dorg.gradle.caching=true | |
- name: short sha | |
id: shortSha | |
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: upload tarball | |
uses: actions/upload-artifact@v3 | |
with: | |
name: besu-${{ steps.shortSha.outputs.sha }}.tar.gz | |
path: 'build/distributions/besu*.tar.gz' | |
- name: upload zipfile | |
uses: actions/upload-artifact@v3 | |
with: | |
name: besu-${{ steps.shortSha.outputs.sha }}.zip | |
path: 'build/distributions/besu*.zip' | |