forked from spotbugs/spotbugs
-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (129 loc) · 6.02 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
on:
push:
branches:
- master
tags:
- '**'
permissions: {}
jobs:
build:
permissions:
contents: write # to push pages branch (peaceiris/actions-gh-pages)
if: github.repository_owner == 'spotbugs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get previous tag for the change log
id: previousTag
run: |
name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
toTag: ${{ env.previousTag }}
fromTag: ${{ github.ref_name }}
writeToFile: true
continue-on-error: true
- name: Commit CHANGELOG.md
if: (github.ref_type == 'tag') && (github.event.base_ref == 'refs/heads/master')
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ github.base_ref}}
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }}'
file_pattern: CHANGELOG.md
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: temurin
cache: gradle
- uses: gradle/actions/wrapper-validation@v4
- name: Download Eclipse
run: |
curl -L 'https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/R-4.24-202206070700/eclipse-SDK-4.24-linux-gtk-x86_64.tar.gz&mirror_id=1' --output eclipse-SDK-4.24-linux-gtk-x86_64.tar.gz
tar xzvf eclipse-SDK-4.24-linux-gtk-x86_64.tar.gz eclipse
echo "eclipseRoot.dir=$(pwd)/eclipse" > eclipsePlugin/local.properties
- name: Build on tag
if: (github.ref_type == 'tag') && (github.event.base_ref == 'refs/heads/master')
run: |
gpg --quiet --batch --yes --decrypt --passphrase="$GPG_SECRET_PASSPHRASE" --output spotbugs.jks .github/workflows/spotbugs.jks.gpg
echo "sonatypeUsername=${SONATYPE_USERNAME}" >> gradle.properties
echo "sonatypePassword=${SONATYPE_PASSWORD}" >> gradle.properties
echo "keystorepass=${KEYSTORE_PASS}" >> gradle.properties
./gradlew assemble publishToSonatype closeAndReleaseSonatypeStagingRepository createReleaseBody --no-daemon
env:
GPG_SECRET_PASSPHRASE: ${{ secrets.GPG_SECRET_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
- name: Build otherwise
if: ${{ !((github.ref_type == 'tag') && (github.event.base_ref == 'refs/heads/master')) }}
run: |
gpg --quiet --batch --yes --decrypt --passphrase="$GPG_SECRET_PASSPHRASE" --output spotbugs.jks .github/workflows/spotbugs.jks.gpg
echo "sonatypeUsername=${SONATYPE_USERNAME}" >> gradle.properties
echo "sonatypePassword=${SONATYPE_PASSWORD}" >> gradle.properties
echo "keystorepass=${KEYSTORE_PASS}" >> gradle.properties
./gradlew assemble publishToSonatype createReleaseBody --no-daemon
env:
GPG_SECRET_PASSPHRASE: ${{ secrets.GPG_SECRET_PASSPHRASE }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
- name: Deploy eclipse-latest
uses: peaceiris/actions-gh-pages@v4
with:
external_repository: spotbugs/eclipse-latest
personal_token: ${{ secrets.PERSONAL_TOKEN_FOR_PAGES }}
publish_branch: gh-pages
publish_dir: ./eclipsePlugin/build/site/eclipse-daily
- name: Deploy eclipse-candidate
uses: peaceiris/actions-gh-pages@v4
if: startsWith(github.ref, 'refs/tags/')
with:
external_repository: spotbugs/eclipse-candidate
personal_token: ${{ secrets.PERSONAL_TOKEN_FOR_PAGES }}
publish_branch: gh-pages
publish_dir: ./eclipsePlugin/build/site/eclipse-candidate
- name: Deploy eclipse
uses: peaceiris/actions-gh-pages@v4
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '_RC') && !contains(github.ref, '_beta')
with:
external_repository: spotbugs/eclipse
personal_token: ${{ secrets.PERSONAL_TOKEN_FOR_PAGES }}
publish_branch: gh-pages
publish_dir: ./eclipsePlugin/build/site/eclipse
- name: Get the version
if: startsWith(github.ref, 'refs/tags/')
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create draft Release
# attach zip, tgz and eclipse plugin to the GitHub Release
# https://github.com/github/hub#github-actions
# https://github.com/actions/upload-release-asset/issues/28#issuecomment-617208601
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: (github.ref_type == 'tag')
run: |
set -x
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
assets=("-a" "./eclipsePlugin/build/distributions/eclipsePlugin.zip")
for asset in ./spotbugs/build/distributions/*; do
assets+=("-a" "$asset")
done
bin/hub release create "${assets[@]}" -F build/release.md "${{ steps.get_version.outputs.VERSION }}" --draft
- name: Publish draft Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: (github.ref_type == 'tag') && (github.event.base_ref == 'refs/heads/master')
run: |
bin/hub release edit ${{ github.ref_name }} --draft=false