File tree Expand file tree Collapse file tree 3 files changed +89
-11
lines changed
Expand file tree Collapse file tree 3 files changed +89
-11
lines changed Original file line number Diff line number Diff line change 1+ name : Build (daily)
2+
3+ on :
4+ schedule :
5+ # daily at 3:24 UTC
6+ - cron : " 24 3 * * *"
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : read
11+
12+ jobs :
13+ publish-snapshots :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
17+
18+ - name : Set up JDK for running Gradle
19+ uses : actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
20+ with :
21+ distribution : temurin
22+ java-version : 17
23+
24+ - name : Set up gradle
25+ uses : gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
26+
27+ - name : Publish snapshots
28+ run : ./gradlew assemble publishToSonatype
29+ env :
30+ SONATYPE_USER : ${{ secrets.SONATYPE_USER }}
31+ SONATYPE_KEY : ${{ secrets.SONATYPE_KEY }}
32+ GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
33+ GPG_PASSWORD : ${{ secrets.GPG_PASSWORD }}
34+ DEVELOCITY_ACCESS_KEY : ${{ secrets.DEVELOCITY_ACCESS_KEY }}
35+
36+ workflow-notification :
37+ permissions :
38+ contents : read
39+ issues : write
40+ needs :
41+ - publish-snapshots
42+ if : always()
43+ uses : ./.github/workflows/reusable-workflow-notification.yml
44+ with :
45+ success : ${{ needs.publish-snapshots.result == 'success' }}
Original file line number Diff line number Diff line change 2929 run : ./gradlew build
3030 env :
3131 DEVELOCITY_ACCESS_KEY : ${{ secrets.DEVELOCITY_ACCESS_KEY }}
32-
33- - name : Publish snapshots
34- # skipping release branches because the versions in those branches are not snapshots
35- if : github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-proto-java'
36- run : ./gradlew publishToSonatype
37- env :
38- SONATYPE_USER : ${{ secrets.SONATYPE_USER }}
39- SONATYPE_KEY : ${{ secrets.SONATYPE_KEY }}
40- GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
41- GPG_PASSWORD : ${{ secrets.GPG_PASSWORD }}
42- DEVELOCITY_ACCESS_KEY : ${{ secrets.DEVELOCITY_ACCESS_KEY }}
Original file line number Diff line number Diff line change 1+ # this is useful because notifications for scheduled workflows are only sent to the user who
2+ # initially created the given workflow
3+ name : Reusable - Workflow notification
4+
5+ on :
6+ workflow_call :
7+ inputs :
8+ success :
9+ type : boolean
10+ required : true
11+
12+ permissions :
13+ contents : read
14+
15+ jobs :
16+ workflow-notification :
17+ permissions :
18+ contents : read
19+ issues : write
20+ runs-on : ubuntu-latest
21+ steps :
22+ - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
23+
24+ - name : Open issue or add comment if issue already open
25+ env :
26+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
27+ run : |
28+ # TODO (trask) search doesn't support exact phrases, so it's possible that this could grab the wrong issue
29+ number=$(gh issue list --search "in:title Workflow failed: $GITHUB_WORKFLOW" --limit 1 --json number -q .[].number)
30+
31+ echo $number
32+ echo ${{ inputs.success }}
33+
34+ if [[ $number ]]; then
35+ if [[ "${{ inputs.success }}" == "true" ]]; then
36+ gh issue close $number
37+ else
38+ gh issue comment $number \
39+ --body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
40+ fi
41+ elif [[ "${{ inputs.success }}" == "false" ]]; then
42+ gh issue create --title "Workflow failed: $GITHUB_WORKFLOW (#$GITHUB_RUN_NUMBER)" \
43+ --body "See [$GITHUB_WORKFLOW #$GITHUB_RUN_NUMBER](https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)."
44+ fi
You can’t perform that action at this time.
0 commit comments