-
Notifications
You must be signed in to change notification settings - Fork 931
134 lines (124 loc) · 5.81 KB
/
Copy pathrelease.yml
File metadata and controls
134 lines (124 loc) · 5.81 KB
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
# Copyright 2020 The Google Java Format Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Release google-java-format
on:
workflow_dispatch:
inputs:
version:
description: "version number for this release."
required: true
jobs:
build-maven-jars:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
java-version: 21
distribution: "zulu"
cache: "maven"
server-id: central
server-username: CI_DEPLOY_USERNAME
server-password: CI_DEPLOY_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Bump Version Number
run: |
mvn --no-transfer-progress versions:set versions:commit -DnewVersion="${GITHUB_EVENT_INPUTS_VERSION}"
mvn --no-transfer-progress versions:set versions:commit -DnewVersion="${GITHUB_EVENT_INPUTS_VERSION}" -pl eclipse_plugin
mvn tycho-versions:update-eclipse-metadata -pl eclipse_plugin
git ls-files | grep -E '(pom.xml|MANIFEST.MF)$' | xargs git add
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "${GITHUB_ACTOR}"
git commit -m "Release google-java-format ${GITHUB_EVENT_INPUTS_VERSION}"
git tag "v${GITHUB_EVENT_INPUTS_VERSION}"
echo "TARGET_COMMITISH=$(git rev-parse HEAD)" >> $GITHUB_ENV
git remote set-url origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/google/google-java-format.git
env:
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}
- name: Deploy to Sonatype staging
env:
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: mvn --no-transfer-progress -pl '!eclipse_plugin' -P sonatype-oss-release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
- name: Build Eclipse plugin
run: mvn --no-transfer-progress -pl 'eclipse_plugin' verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
- name: Push tag
run: |
git push origin "v${GITHUB_EVENT_INPUTS_VERSION}"
env:
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}
- name: Add Artifacts to Release Entry
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
draft: true
name: ${{ github.event.input.version }}
tag_name: "v${{ github.event.inputs.version }}"
target_commitish: ${{ env.TARGET_COMMITISH }}
files: |
core/target/google-java-format-*.jar
eclipse_plugin/target/google-java-format-eclipse-plugin-*.jar
build-native-image:
name: "Build GraalVM native-image on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
permissions:
contents: write
needs: build-maven-jars
strategy:
matrix:
# Use "oldest" available ubuntu-* instead of -latest,
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories;
# due to https://github.com/google/google-java-format/issues/1072.
os: [ubuntu-22.04, ubuntu-22.04-arm, macos-latest, windows-latest]
env:
# NB: Must keep the keys in this inline JSON below in line with the os: above!
SUFFIX: ${{fromJson('{"ubuntu-22.04":"linux-x86-64", "ubuntu-22.04-arm":"linux-arm64", "macos-latest":"darwin-arm64", "windows-latest":"windows-x86-64"}')[matrix.os]}}
EXTENSION: ${{ matrix.os == 'windows-latest' && '.exe' || '' }}
steps:
- name: "Check out repository"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Set up GraalVM"
uses: graalvm/setup-graalvm@5298d94fb55a4f185c602eeac5de1b553882abe2 # v1.6.4
with:
java-version: "25"
distribution: "graalvm-community"
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: "true"
cache: "maven"
- name: Bump Version Number
env:
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}
run: mvn --no-transfer-progress versions:set versions:commit -DnewVersion="${GITHUB_EVENT_INPUTS_VERSION}"
- name: "Native"
run: mvn -Pnative -DskipTests package -pl core -am
- name: "Move outputs"
run: cp core/target/google-java-format${EXTENSION} google-java-format_${SUFFIX}${EXTENSION}
- name: "Upload native-image"
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}
run: gh release upload "v${GITHUB_EVENT_INPUTS_VERSION}" "google-java-format_${SUFFIX}${EXTENSION}"