-
Notifications
You must be signed in to change notification settings - Fork 1.4k
130 lines (116 loc) · 6.08 KB
/
prepare-release.yml
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
name: Prepare Jib release
on:
workflow_dispatch:
inputs:
project:
description: Jib project to release
required: true
default: (build-plan | core | maven | gradle | extension-common | maven-extension | gradle-extension)
release_version:
description: new release version
required: true
default: (for example, 0.1.0)
jobs:
release:
name: Prepare Jib release
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Check input
run: |
echo '* input project: "${{ github.event.inputs.project }}"'
case ${{ github.event.inputs.project }} in
build-plan|core|maven|gradle|extension-common|maven-extension|gradle-extension) ;;
*) echo 'invalid input project name "${{ github.event.inputs.project }}"'
exit 1
;;
esac
if [[ ! "${{ github.event.inputs.release_version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo 'version "${{ github.event.inputs.release_version }}" not in ###.###.### format'
exit 1
fi
- name: Build project
run: |
# TODO: run integration test? (Requries auth with GCP.)
./gradlew clean build --stacktrace
- name: Run Gradle release
run: |
git checkout -b ${{ github.event.inputs.project }}-release-v${{ github.event.inputs.release_version }}
git config user.email ${{ github.actor }}@users.noreply.github.com
git config user.name ${{ github.actor }}
PROJECT=$( case ${{ github.event.inputs.project }} in
extension-common) echo jib-plugins-extension-common ;;
maven-extension) echo jib-maven-plugin-extension-api ;;
gradle-extension) echo jib-gradle-plugin-extension-api ;;
maven|gradle) echo jib-${{ github.event.inputs.project }}-plugin ;;
*) echo jib-${{ github.event.inputs.project }} ;;
esac )
# This creates the tag (e.g., "v0.1.0-gradle") and pushes the updated
# branch (e.g., "gradle-release-v0.1.0") and the new tag.
./gradlew "${PROJECT}":release \
-Prelease.useAutomaticVersion=true \
-Prelease.releaseVersion=${{ github.event.inputs.release_version }}
- name: Create pull request
uses: repo-sync/[email protected]
id: create-pr
with:
github_token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
source_branch: ${{ github.event.inputs.project }}-release-v${{ github.event.inputs.release_version }}
pr_title: "${{ github.event.inputs.project }} release v${{ github.event.inputs.release_version }}"
pr_body: "To be merged after the release is complete."
pr_label: "PR: Merge After Release"
- name: Draft Maven/Gradle GitHub release
uses: actions/[email protected]
id: create-plugin-release
if: ${{ github.event.inputs.project == 'maven' || github.event.inputs.project == 'gradle' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.release_version }}-${{ github.event.inputs.project }}
release_name: jib-${{ github.event.inputs.project }}-plugin v${{ github.event.inputs.release_version }}
draft: true
body: |
**Run `./jib-${{ github.event.inputs.project }}-plugin/scripts/update_gcs_latest.sh ${{ github.event.inputs.release_version }}`
when the release is complete to update the latest version string on GCS.**
---
### Major Changes
See [CHANGELOG.md](https://github.com/GoogleContainerTools/jib/blob/master/jib-${{ github.event.inputs.project }}-plugin/CHANGELOG.md) for more details.
- name: Create Maven/Gradle release checklist issue
uses: JasonEtco/[email protected]
if: ${{ github.event.inputs.project == 'maven' || github.event.inputs.project == 'gradle' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: v${{ github.event.inputs.release_version }}-${{ github.event.inputs.project }}
CHANGELOG_URL: https://github.com/GoogleContainerTools/jib/blob/master/jib-${{ github.event.inputs.project }}-plugin/CHANGELOG.md
README_URL: https://github.com/GoogleContainerTools/jib/blob/master/jib-${{ github.event.inputs.project }}-plugin/README.md
GCS_UPDATE_SCRIPT: "`./jib-${{ github.event.inputs.project }}-plugin/scripts/update_gcs_latest.sh ${{ github.event.inputs.release_version }}`"
RELEASE_DRAFT: ${{ steps.create-plugin-release.outputs.html_url }}
RELEASE_PR: ${{steps.create-pr.outputs.pr_url}}
with:
filename: .github/RELEASE_TEMPLATES/plugin_release_checklist.md
- name: Draft Core GitHub release
uses: actions/[email protected]
id: create-core-release
if: ${{ github.event.inputs.project == 'core' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.release_version }}-core
release_name: jib-core v${{ github.event.inputs.release_version }}
draft: true
body: |
### Major Changes
See [CHANGELOG.md](https://github.com/GoogleContainerTools/jib/blob/master/jib-core/CHANGELOG.md) for more details.
- name: Create Core release checklist issue
uses: JasonEtco/[email protected]
if: ${{ github.event.inputs.project == 'core' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: v${{ github.event.inputs.release_version }}-core
CHANGELOG_URL: https://github.com/GoogleContainerTools/jib/blob/master/jib-core/CHANGELOG.md
README_URL: https://github.com/GoogleContainerTools/jib/blob/master/jib-core/README.md
RELEASE_DRAFT: ${{ steps.create-core-release.outputs.html_url }}
RELEASE_PR: ${{steps.create-pr.outputs.pr_url}}
with:
filename: .github/RELEASE_TEMPLATES/core_release_checklist.md