-
Notifications
You must be signed in to change notification settings - Fork 224
182 lines (173 loc) · 6.52 KB
/
prerelease.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Prerelease
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: prerelease
push:
branches: [ main, feature/* ]
jobs:
generate_artifact_toolkit_standalone:
strategy:
matrix:
supported_versions: [ '2023.3', '2024.1', '2024.2' ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: remove unwanted dependencies
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.x'
- name: Generate artifact
run: |
./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-toolkit:intellij-standalone:buildPlugin
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: plugin-standalone-${{ matrix.supported_versions }}
path: ./plugins/toolkit/intellij-standalone/build/distributions/*.zip
retention-days: 1
generate_artifact_q:
strategy:
matrix:
supported_versions: [ '2023.3', '2024.1', '2024.2' ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: remove unwanted dependencies
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
- name: Generate artifact
run: |
./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-amazonq:buildPlugin
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: plugin-amazonq-${{ matrix.supported_versions }}
path: ./plugins/amazonq/build/distributions/*.zip
retention-days: 1
generate_artifact_core:
strategy:
matrix:
supported_versions: [ '2023.3', '2024.1', '2024.2' ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: remove unwanted dependencies
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
- name: Generate artifact
run: |
./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-core:buildPlugin
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: plugin-core-${{ matrix.supported_versions }}
path: ./plugins/core/build/distributions/*.zip
retention-days: 1
generate_changelog:
runs-on: ubuntu-latest
outputs:
feature: ${{ steps.assign_output.outputs.feature }}
tagname: ${{ steps.assign_output.outputs.tagname }}
version: ${{ steps.assign_output.outputs.version }}
changes: ${{ steps.assign_output.outputs.changes }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
- if: github.event_name == 'workflow_dispatch'
run: |
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.ref_name != 'main'
run: |
TAG_NAME=${{ github.ref_name }}
FEAT_NAME=$(echo $TAG_NAME | sed 's/feature\///')
echo "FEAT_NAME=$FEAT_NAME" >> $GITHUB_ENV
echo "TAG_NAME=pre-$FEAT_NAME" >> $GITHUB_ENV
- if: github.ref_name == 'main'
run: |
echo "FEAT_NAME=" >> $GITHUB_ENV
echo "TAG_NAME=prerelease" >> $GITHUB_ENV
- name: Generate changelog
id: changelog
run: |
./gradlew :createRelease :generateChangelog
- name: Provide the metadata to output
id: assign_output
run: |
echo "feature=$FEAT_NAME" >> $GITHUB_OUTPUT
echo "tagname=$TAG_NAME" >> $GITHUB_OUTPUT
echo "version=$(cat gradle.properties | grep toolkitVersion | cut -d'=' -f2)" >> $GITHUB_OUTPUT
echo 'changes<<EOF' >> $GITHUB_OUTPUT
cat CHANGELOG.md | perl -ne 'BEGIN{$/="\n\n"} print; exit if $. == 1' >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
publish:
needs: [ generate_artifact_toolkit_standalone, generate_artifact_core, generate_artifact_q, generate_changelog ]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
FEAT_NAME: ${{ needs.generate_changelog.outputs.feature }}
TAG_NAME: ${{ needs.generate_changelog.outputs.tagname }}
AWS_TOOLKIT_VERSION: ${{ needs.generate_changelog.outputs.version }}
BRANCH: ${{ github.ref_name }}
AWS_TOOLKIT_CHANGES: ${{ needs.generate_changelog.outputs.changes }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Delete existing prerelease
# "prerelease" (main branch) or "pre-<feature>"
if: "env.TAG_NAME == 'prerelease' || startsWith(env.TAG_NAME, 'pre-')"
run: |
echo "SUBJECT=AWS Toolkit ${AWS_TOOLKIT_VERSION}: ${FEAT_NAME:-${TAG_NAME}}" >> $GITHUB_ENV
gh release delete "$TAG_NAME" --cleanup-tag --yes || true
- name: Publish to GitHub Releases
run: |
envsubst < "$GITHUB_WORKSPACE/.github/workflows/prerelease_notes.md" > "$RUNNER_TEMP/prerelease_notes.md"
gh release create "$TAG_NAME" --prerelease --notes-file "$RUNNER_TEMP/prerelease_notes.md" --title "$SUBJECT" --target $GITHUB_SHA plugin-standalone-*/*.zip
- name: Publish core
run: |
gh release upload "$TAG_NAME" plugin-core-*/*.zip
- name: Publish Q
run: |
gh release upload "$TAG_NAME" plugin-amazonq-*/*.zip
- name: Publish XML manifest
run: |
gh release view "$TAG_NAME" --repo "$GITHUB_REPOSITORY" --json assets | python3 "$GITHUB_WORKSPACE/.github/workflows/generateUpdatesXml.py" - > updatePlugins.xml
gh release upload "$TAG_NAME" updatePlugins.xml