|
| 1 | +name: Prerelease |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + tag_name: |
| 6 | + description: 'Tag name for release' |
| 7 | + required: false |
| 8 | + default: prerelease |
| 9 | + push: |
| 10 | + branches: [ main, feature/* ] |
| 11 | + |
| 12 | + |
| 13 | +jobs: |
| 14 | + generate_artifact_toolkit: |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + supported_versions: [ '2023.3', '2023.2', '2024.1' ] |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + - name: remove unwanted dependencies |
| 24 | + run: | |
| 25 | + sudo rm -rf /usr/share/dotnet |
| 26 | + sudo rm -rf /opt/ghc |
| 27 | + sudo rm -rf "/usr/local/share/boost" |
| 28 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 29 | + - uses: actions/setup-java@v4 |
| 30 | + with: |
| 31 | + distribution: 'corretto' |
| 32 | + java-version: '17' |
| 33 | + - uses: actions/setup-dotnet@v4 |
| 34 | + with: |
| 35 | + dotnet-version: '6.x' |
| 36 | + - name: Generate artifact |
| 37 | + run: | |
| 38 | + ./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-toolkit:intellij:buildPlugin |
| 39 | + - name: Upload artifact |
| 40 | + uses: actions/upload-artifact@v4 |
| 41 | + with: |
| 42 | + name: plugin-toolkit-${{ matrix.supported_versions }} |
| 43 | + path: ./plugins/toolkit/intellij/build/distributions/*.zip |
| 44 | + retention-days: 1 |
| 45 | + generate_artifact_toolkit_standalone: |
| 46 | + strategy: |
| 47 | + matrix: |
| 48 | + supported_versions: [ '2023.3', '2023.2', '2024.1' ] |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + with: |
| 53 | + fetch-depth: 0 |
| 54 | + - name: remove unwanted dependencies |
| 55 | + run: | |
| 56 | + sudo rm -rf /usr/share/dotnet |
| 57 | + sudo rm -rf /opt/ghc |
| 58 | + sudo rm -rf "/usr/local/share/boost" |
| 59 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 60 | + - uses: actions/setup-java@v4 |
| 61 | + with: |
| 62 | + distribution: 'corretto' |
| 63 | + java-version: '17' |
| 64 | + - uses: actions/setup-dotnet@v4 |
| 65 | + with: |
| 66 | + dotnet-version: '6.x' |
| 67 | + - name: Generate artifact |
| 68 | + run: | |
| 69 | + ./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-toolkit:intellij-standalone:buildPlugin |
| 70 | + - name: Upload artifact |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: plugin-standalone-${{ matrix.supported_versions }} |
| 74 | + path: ./plugins/toolkit/intellij-standalone/build/distributions/*.zip |
| 75 | + retention-days: 1 |
| 76 | + |
| 77 | + generate_artifact_q: |
| 78 | + strategy: |
| 79 | + matrix: |
| 80 | + supported_versions: [ '2023.3', '2023.2', '2024.1' ] |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v4 |
| 84 | + with: |
| 85 | + fetch-depth: 0 |
| 86 | + - name: remove unwanted dependencies |
| 87 | + run: | |
| 88 | + sudo rm -rf /usr/share/dotnet |
| 89 | + sudo rm -rf /opt/ghc |
| 90 | + sudo rm -rf "/usr/local/share/boost" |
| 91 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 92 | + - uses: actions/setup-java@v4 |
| 93 | + with: |
| 94 | + distribution: 'corretto' |
| 95 | + java-version: '17' |
| 96 | + - name: Generate artifact |
| 97 | + run: | |
| 98 | + ./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-amazonq:buildPlugin --exclude-task buildResharperPlugin |
| 99 | + - name: Upload artifact |
| 100 | + uses: actions/upload-artifact@v4 |
| 101 | + with: |
| 102 | + name: plugin-amazonq-${{ matrix.supported_versions }} |
| 103 | + path: ./plugins/amazonq/build/distributions/*.zip |
| 104 | + retention-days: 1 |
| 105 | + |
| 106 | + generate_artifact_core: |
| 107 | + strategy: |
| 108 | + matrix: |
| 109 | + supported_versions: [ '2023.3', '2023.2', '2024.1' ] |
| 110 | + runs-on: ubuntu-latest |
| 111 | + steps: |
| 112 | + - uses: actions/checkout@v4 |
| 113 | + with: |
| 114 | + fetch-depth: 0 |
| 115 | + - name: remove unwanted dependencies |
| 116 | + run: | |
| 117 | + sudo rm -rf /usr/share/dotnet |
| 118 | + sudo rm -rf /opt/ghc |
| 119 | + sudo rm -rf "/usr/local/share/boost" |
| 120 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 121 | + - uses: actions/setup-java@v4 |
| 122 | + with: |
| 123 | + distribution: 'corretto' |
| 124 | + java-version: '17' |
| 125 | + |
| 126 | + - name: Generate artifact |
| 127 | + run: | |
| 128 | +
|
| 129 | + ./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-core:buildPlugin |
| 130 | + - name: Upload artifact |
| 131 | + uses: actions/upload-artifact@v4 |
| 132 | + with: |
| 133 | + name: plugin-core-${{ matrix.supported_versions }} |
| 134 | + path: ./plugins/core/build/distributions/*.zip |
| 135 | + retention-days: 1 |
| 136 | + |
| 137 | + generate_changelog: |
| 138 | + runs-on: ubuntu-latest |
| 139 | + outputs: |
| 140 | + feature: ${{ steps.assign_output.outputs.feature }} |
| 141 | + tagname: ${{ steps.assign_output.outputs.tagname }} |
| 142 | + version: ${{ steps.assign_output.outputs.version }} |
| 143 | + changes: ${{ steps.assign_output.outputs.changes }} |
| 144 | + steps: |
| 145 | + - uses: actions/checkout@v4 |
| 146 | + |
| 147 | + - uses: actions/setup-java@v4 |
| 148 | + with: |
| 149 | + distribution: 'corretto' |
| 150 | + java-version: '17' |
| 151 | + |
| 152 | + - if: github.event_name == 'workflow_dispatch' |
| 153 | + run: | |
| 154 | + echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV |
| 155 | + - if: github.ref_name != 'main' |
| 156 | + run: | |
| 157 | + TAG_NAME=${{ github.ref_name }} |
| 158 | + FEAT_NAME=$(echo $TAG_NAME | sed 's/feature\///') |
| 159 | + echo "FEAT_NAME=$FEAT_NAME" >> $GITHUB_ENV |
| 160 | + echo "TAG_NAME=pre-$FEAT_NAME" >> $GITHUB_ENV |
| 161 | + - if: github.ref_name == 'main' |
| 162 | + run: | |
| 163 | + echo "FEAT_NAME=" >> $GITHUB_ENV |
| 164 | + echo "TAG_NAME=prerelease" >> $GITHUB_ENV |
| 165 | + - name: Generate changelog |
| 166 | + id: changelog |
| 167 | + run: | |
| 168 | + ./gradlew :createRelease :generateChangelog |
| 169 | + - name: Provide the metadata to output |
| 170 | + id: assign_output |
| 171 | + run: | |
| 172 | + echo "feature=$FEAT_NAME" >> $GITHUB_OUTPUT |
| 173 | + echo "tagname=$TAG_NAME" >> $GITHUB_OUTPUT |
| 174 | + echo "version=$(cat gradle.properties | grep toolkitVersion | cut -d'=' -f2)" >> $GITHUB_OUTPUT |
| 175 | + echo 'changes<<EOF' >> $GITHUB_OUTPUT |
| 176 | + cat CHANGELOG.md | perl -ne 'BEGIN{$/="\n\n"} print; exit if $. == 1' >> $GITHUB_OUTPUT |
| 177 | + echo 'EOF' >> $GITHUB_OUTPUT |
| 178 | +
|
| 179 | + publish: |
| 180 | + needs: [ generate_artifact_toolkit, generate_artifact_toolkit_standalone, generate_artifact_core, generate_artifact_q, generate_changelog ] |
| 181 | + env: |
| 182 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 183 | + GH_REPO: ${{ github.repository }} |
| 184 | + FEAT_NAME: ${{ needs.generate_changelog.outputs.feature }} |
| 185 | + TAG_NAME: ${{ needs.generate_changelog.outputs.tagname }} |
| 186 | + AWS_TOOLKIT_VERSION: ${{ needs.generate_changelog.outputs.version }} |
| 187 | + BRANCH: ${{ github.ref_name }} |
| 188 | + AWS_TOOLKIT_CHANGES: ${{ needs.generate_changelog.outputs.changes }} |
| 189 | + runs-on: ubuntu-latest |
| 190 | + permissions: |
| 191 | + contents: write |
| 192 | + steps: |
| 193 | + - uses: actions/checkout@v4 |
| 194 | + - uses: actions/download-artifact@v4 |
| 195 | + - name: Delete existing prerelease |
| 196 | + # "prerelease" (main branch) or "pre-<feature>" |
| 197 | + if: "env.TAG_NAME == 'prerelease' || startsWith(env.TAG_NAME, 'pre-')" |
| 198 | + run: | |
| 199 | + echo "SUBJECT=AWS Toolkit ${AWS_TOOLKIT_VERSION}: ${FEAT_NAME:-${TAG_NAME}}" >> $GITHUB_ENV |
| 200 | + gh release delete "$TAG_NAME" --cleanup-tag --yes || true |
| 201 | + - name: Publish to GitHub Releases |
| 202 | + run: | |
| 203 | + envsubst < "$GITHUB_WORKSPACE/.github/workflows/prerelease_notes.md" > "$RUNNER_TEMP/prerelease_notes.md" |
| 204 | + gh release create $TAG_NAME --prerelease --notes-file "$RUNNER_TEMP/prerelease_notes.md" --title "$SUBJECT" --target $GITHUB_SHA plugin-toolkit-*/*.zip |
| 205 | + - name: Publish core |
| 206 | + run: | |
| 207 | + gh release upload $TAG_NAME plugin-core-*/*.zip |
| 208 | + - name: Publish Q |
| 209 | + run: | |
| 210 | + gh release upload $TAG_NAME plugin-amazonq-*/*.zip |
| 211 | + - name: Publish Toolkit Standalone |
| 212 | + run: | |
| 213 | + gh release upload $TAG_NAME plugin-standalone-*/*.zip |
0 commit comments