switch from and to tags #53
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
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '**' | |
permissions: {} | |
jobs: | |
build: | |
permissions: | |
contents: write # to push pages branch (peaceiris/actions-gh-pages) | |
if: github.repository_owner == 'JuditKnoll' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Print data | |
run: | | |
echo "github.ref_type = ${{github.ref_type}}" | |
echo "github.event.base_ref = ${{github.event.base_ref}}" | |
- name: Get Next Version | |
if: ${{ github.ref_name == 'release' }} | |
id: semver | |
uses: ietf-tools/semver-action@v1 | |
with: | |
token: ${{ github.token }} | |
branch: release | |
skipInvalidTags: true | |
- name: Update CHANGELOG | |
id: changelog | |
uses: requarks/changelog-action@v1 | |
with: | |
token: ${{ github.token }} | |
fromTag: ${{ github.ref }} | |
toTag: ${{ env.previousTag }} | |
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 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: temurin | |
cache: gradle | |
- uses: gradle/wrapper-validation-action@v2 | |
- 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=eller86 >> 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_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=eller86 >> 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_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@v3 | |
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@v3 | |
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@v3 | |
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 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') && (github.event.base_ref == 'refs/heads/master') | |
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 }}" |