Skip to content

Commit

Permalink
Merge pull request #198 from giulong/release/v1.11.1
Browse files Browse the repository at this point in the history
single job to bump version and then deploy to OSSRH
  • Loading branch information
giulong authored Jul 11, 2024
2 parents 68fe391 + d6dee05 commit f66537d
Showing 1 changed file with 52 additions and 77 deletions.
129 changes: 52 additions & 77 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,82 +14,12 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pages: write
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- id: install-secret-key
name: Install gpg secret key
run: cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import

- name: Set up JDK 21
uses: actions/setup-java@v4.0.0
with:
java-version: 21
distribution: temurin
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Publish package
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: ./mvnw deploy -DskipTests -Dmaven.plugin.validation=NONE -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -ntp

- name: Get version from pom.xml
run: |
VERSION=$( ./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout )
echo "version=$VERSION" >> $GITHUB_ENV
id: get_version

- name: Spectrum submodule package
run: ./mvnw package -DskipSign -Dmaven.plugin.validation=NONE -ntp -pl spectrum

- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: ${{ env.DOCS_FOLDER }}/jacoco/jacoco.csv
branches-label: Branches
badges-directory: ${{ env.DOCS_FOLDER }}/badges
intervals: 95 87.5 75 67.5 60 0
fail-if-coverage-less-than: 0.9
fail-if-branches-less-than: 0.9

- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branches = ${{ steps.jacoco.outputs.branches }}"
- name: Setup GitHub Pages
uses: actions/configure-pages@v3

- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: docs/
destination: ./_site

- name: Upload GitHub Pages Artifact
uses: actions/upload-pages-artifact@v2

- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

bump:
name: Bump Version
needs: deploy
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Free Disk Space
shell: bash
Expand All @@ -111,6 +41,9 @@ jobs:
java-version: 21
distribution: temurin
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Get Spectrum new version
id: get-version
Expand All @@ -122,18 +55,27 @@ jobs:
- name: Bump Spectrum version
shell: bash
run: ./mvnw versions:set-property -DgenerateBackupPoms=false -Dproperty=revision -DnewVersion=$NEW_VERSION -ntp
run: ./mvnw versions:set-property -Dmaven.plugin.validation=NONE -DgenerateBackupPoms=false -Dproperty=revision -DnewVersion=$NEW_VERSION -ntp

- id: install-secret-key
name: Install gpg secret key
run: cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import

- name: Publish package
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: ./mvnw deploy -DskipTests -Dmaven.plugin.validation=NONE -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -ntp

- name: Generate new public Json Schema
shell: bash
run: |
./mvnw install -DskipTests -DskipSign -ntp -P framework-only
./mvnw jsonschema:generate@public -pl spectrum -ntp
run: ./mvnw install -Dmaven.plugin.validation=NONE -DskipTests -DskipSign -ntp -P framework-only

- name: Commit files and generate new tag
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -a -m "Bumping Spectrum version to $NEW_VERSION"
git tag v$NEW_VERSION
Expand All @@ -145,15 +87,48 @@ jobs:
tags: true
atomic: true

- name: Cherry pick on develop
- name: Merge on develop
run: |
export GIT_MERGE_AUTOEDIT=no
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git checkout develop
git cherry-pick -x main
git merge main
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: develop

- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: ${{ env.DOCS_FOLDER }}/jacoco/jacoco.csv
branches-label: Branches
badges-directory: ${{ env.DOCS_FOLDER }}/badges
intervals: 95 87.5 75 67.5 60 0
fail-if-coverage-less-than: 0.9
fail-if-branches-less-than: 0.9

- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branches = ${{ steps.jacoco.outputs.branches }}"
- name: Setup GitHub Pages
uses: actions/configure-pages@v3

- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: docs/
destination: ./_site

- name: Upload GitHub Pages Artifact
uses: actions/upload-pages-artifact@v2

- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit f66537d

Please sign in to comment.