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: Setup Signing Key 17 run: | 18 gpg-agent --daemon --default-cache-ttl 7200 19 echo -e "${{ secrets.GPG_SIGNING_KEY }}" | gpg --batch --import --no-tty 20 echo "hello world" > temp.txt 21 gpg --detach-sig --yes -v --output=/dev/null --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" temp.txt 22 rm temp.txt 23 gpg --list-secret-keys --keyid-format LONG 24 25 - name: Checkout 26 uses: actions/checkout@v2.4.0 27 28 - name: Set up JDK 29 uses: actions/setup-java@v2.5.0 30 with: 31 java-version: 17 32 distribution: 'zulu' 33 cache: 'maven' 34 server-id: sonatype-nexus-staging 35 server-username: CI_DEPLOY_USERNAME 36 server-password: CI_DEPLOY_PASSWORD 37 38 - name: Bump Version Number 39 run: | 40 mvn --no-transfer-progress versions:set versions:commit -DnewVersion="${{ github.event.inputs.version }}" 41 mvn tycho-versions:update-eclipse-metadata -pl eclipse_plugin 42 git ls-files | grep 'pom.xml$' | xargs git add 43 git config --global user.email "${{ github.actor }}@users.noreply.github.com" 44 git config --global user.name "${{ github.actor }}" 45 git commit -m "Release google-java-format ${{ github.event.inputs.version }}" 46 git tag "v${{ github.event.inputs.version }}" 47 echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV 48 git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/google/google-java-format.git 49 50 - name: Deploy to Sonatype staging 51 env: 52 CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} 53 CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} 54 run: 55 mvn --no-transfer-progress -pl '!eclipse_plugin' -P sonatype-oss-release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" 56 57 - name: Build Eclipse plugin 58 run: 59 mvn --no-transfer-progress -pl 'eclipse_plugin' verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" 60 61 - name: Push tag 62 run: | 63 git push origin "v${{ github.event.inputs.version }}" 64 65 - name: Add Jars to Release Entry 66 uses: softprops/action-gh-release@v0.1.14 67 with: 68 draft: true 69 name: ${{ github.event.input.version }} 70 tag_name: "v${{ github.event.inputs.version }}" 71 target_commitish: ${{ env.TARGET_COMMITISH }} 72 files: | 73 core/target/google-java-format-*.jar 74 eclipse_plugin/target/google-java-format-eclipse-plugin-*.jar 75