• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Release google-java-format
2
3on:
4  workflow_dispatch:
5    inputs:
6      version:
7        description: "version number for this release."
8        required: true
9
10jobs:
11  build-maven-jars:
12    runs-on: ubuntu-latest
13    permissions:
14      contents: write
15    steps:         
16      - name: Checkout
17        uses: actions/checkout@v2.4.0
18
19      - name: Set up JDK
20        uses: actions/setup-java@v2.5.0
21        with:
22          java-version: 17
23          distribution: 'zulu'
24          cache: 'maven'
25          server-id: sonatype-nexus-staging
26          server-username: CI_DEPLOY_USERNAME
27          server-password: CI_DEPLOY_PASSWORD
28          gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
29          gpg-passphrase: MAVEN_GPG_PASSPHRASE
30
31      - name: Bump Version Number
32        run: |
33          mvn --no-transfer-progress versions:set versions:commit -DnewVersion="${{ github.event.inputs.version }}"
34          mvn --no-transfer-progress versions:set versions:commit -DnewVersion="${{ github.event.inputs.version }}" -pl eclipse_plugin
35          mvn tycho-versions:update-eclipse-metadata -pl eclipse_plugin
36          git ls-files | grep -E '(pom.xml|MANIFEST.MF)$' | xargs git add
37          git config --global user.email "${{ github.actor }}@users.noreply.github.com"
38          git config --global user.name "${{ github.actor }}"
39          git commit -m "Release google-java-format ${{ github.event.inputs.version }}"
40          git tag "v${{ github.event.inputs.version }}"
41          echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV
42          git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/google/google-java-format.git
43
44      - name: Deploy to Sonatype staging
45        env:
46          CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
47          CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
48          GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
49        run:
50          mvn --no-transfer-progress -pl '!eclipse_plugin' -P sonatype-oss-release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
51
52      - name: Build Eclipse plugin
53        run:
54          mvn --no-transfer-progress -pl 'eclipse_plugin' verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
55
56      - name: Push tag
57        run: |
58          git push origin "v${{ github.event.inputs.version }}"
59
60      - name: Add Jars to Release Entry
61        uses: softprops/action-gh-release@v0.1.14
62        with:
63          draft: true
64          name: ${{ github.event.input.version }}
65          tag_name: "v${{ github.event.inputs.version }}"
66          target_commitish: ${{ env.TARGET_COMMITISH }}
67          files: |
68            core/target/google-java-format-*.jar
69            eclipse_plugin/target/google-java-format-eclipse-plugin-*.jar
70