|
| 1 | +name: Prerelease Q-only |
| 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: [ feature/q-mega ] |
| 11 | + |
| 12 | +jobs: |
| 13 | + time: |
| 14 | + outputs: |
| 15 | + time: ${{ steps.time.outputs.time }} |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - id: time |
| 19 | + run: | |
| 20 | + echo "time=$(date +%s)" >> "$GITHUB_OUTPUT" |
| 21 | +
|
| 22 | + generate_artifact_q: |
| 23 | + needs: [ time ] |
| 24 | + strategy: |
| 25 | + matrix: |
| 26 | + supported_versions: [ '2023.3', '2024.1', '2024.2', '2024.3' ] |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + - name: remove unwanted dependencies |
| 33 | + run: | |
| 34 | + sudo rm -rf /usr/share/dotnet |
| 35 | + sudo rm -rf /opt/ghc |
| 36 | + sudo rm -rf "/usr/local/share/boost" |
| 37 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 38 | + - uses: actions/setup-java@v4 |
| 39 | + with: |
| 40 | + distribution: 'corretto' |
| 41 | + java-version: '21' |
| 42 | + - name: Generate artifact |
| 43 | + run: | |
| 44 | + sed -i.bak "s/\(toolkitVersion\s*=\s*\)\(.*\)/\1\2-${{ needs.time.outputs.time }}/" gradle.properties |
| 45 | + ./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-amazonq:buildPlugin |
| 46 | + - name: Upload artifact |
| 47 | + uses: actions/upload-artifact@v4 |
| 48 | + with: |
| 49 | + name: plugin-amazonq-${{ matrix.supported_versions }} |
| 50 | + path: ./plugins/amazonq/build/distributions/*.zip |
| 51 | + retention-days: 1 |
| 52 | + |
| 53 | + generate_artifact_core: |
| 54 | + needs: [ time ] |
| 55 | + strategy: |
| 56 | + matrix: |
| 57 | + supported_versions: [ '2023.3', '2024.1', '2024.2', '2024.3' ] |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + fetch-depth: 0 |
| 63 | + - name: remove unwanted dependencies |
| 64 | + run: | |
| 65 | + sudo rm -rf /usr/share/dotnet |
| 66 | + sudo rm -rf /opt/ghc |
| 67 | + sudo rm -rf "/usr/local/share/boost" |
| 68 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 69 | + - uses: actions/setup-java@v4 |
| 70 | + with: |
| 71 | + distribution: 'corretto' |
| 72 | + java-version: '21' |
| 73 | + |
| 74 | + - name: Generate artifact |
| 75 | + run: | |
| 76 | + sed -i.bak "s/\(toolkitVersion\s*=\s*\)\(.*\)/\1\2-${{ needs.time.outputs.time }}/" gradle.properties |
| 77 | + ./gradlew -PideProfileName=${{ matrix.supported_versions }} :plugin-core:buildPlugin |
| 78 | + - name: Upload artifact |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: plugin-core-${{ matrix.supported_versions }} |
| 82 | + path: ./plugins/core/build/distributions/*.zip |
| 83 | + retention-days: 1 |
| 84 | + |
| 85 | + generate_changelog: |
| 86 | + needs: [ time ] |
| 87 | + runs-on: ubuntu-latest |
| 88 | + outputs: |
| 89 | + feature: ${{ steps.assign_output.outputs.feature }} |
| 90 | + tagname: ${{ steps.assign_output.outputs.tagname }} |
| 91 | + version: ${{ steps.assign_output.outputs.version }} |
| 92 | + changes: ${{ steps.assign_output.outputs.changes }} |
| 93 | + steps: |
| 94 | + - uses: actions/checkout@v4 |
| 95 | + |
| 96 | + - uses: actions/setup-java@v4 |
| 97 | + with: |
| 98 | + distribution: 'corretto' |
| 99 | + java-version: '21' |
| 100 | + |
| 101 | + - if: github.event_name == 'workflow_dispatch' |
| 102 | + run: | |
| 103 | + echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV |
| 104 | + - if: github.ref_name != 'main' |
| 105 | + run: | |
| 106 | + TAG_NAME=${{ github.ref_name }} |
| 107 | + FEAT_NAME=$(echo $TAG_NAME | sed 's/feature\///') |
| 108 | + echo "FEAT_NAME=$FEAT_NAME" >> $GITHUB_ENV |
| 109 | + echo "TAG_NAME=pre-$FEAT_NAME" >> $GITHUB_ENV |
| 110 | + - if: github.ref_name == 'main' |
| 111 | + run: | |
| 112 | + echo "FEAT_NAME=" >> $GITHUB_ENV |
| 113 | + echo "TAG_NAME=prerelease" >> $GITHUB_ENV |
| 114 | + - name: Generate changelog |
| 115 | + id: changelog |
| 116 | + run: | |
| 117 | + sed -i.bak "s/\(toolkitVersion\s*=\s*\)\(.*\)/\1\2-${{ needs.time.outputs.time }}/" gradle.properties |
| 118 | + ./gradlew :createRelease :generateChangelog |
| 119 | + - name: Provide the metadata to output |
| 120 | + id: assign_output |
| 121 | + run: | |
| 122 | + echo "feature=$FEAT_NAME" >> $GITHUB_OUTPUT |
| 123 | + echo "tagname=$TAG_NAME" >> $GITHUB_OUTPUT |
| 124 | + echo "version=$(cat gradle.properties | grep toolkitVersion | cut -d'=' -f2)" >> $GITHUB_OUTPUT |
| 125 | + echo 'changes<<EOF' >> $GITHUB_OUTPUT |
| 126 | + cat CHANGELOG.md | perl -ne 'BEGIN{$/="\n\n"} print; exit if $. == 1' >> $GITHUB_OUTPUT |
| 127 | + echo 'EOF' >> $GITHUB_OUTPUT |
| 128 | +
|
| 129 | + publish: |
| 130 | + needs: [ generate_artifact_core, generate_artifact_q, generate_changelog ] |
| 131 | + env: |
| 132 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 133 | + GH_REPO: ${{ github.repository }} |
| 134 | + FEAT_NAME: ${{ needs.generate_changelog.outputs.feature }} |
| 135 | + TAG_NAME: ${{ needs.generate_changelog.outputs.tagname }} |
| 136 | + AWS_TOOLKIT_VERSION: ${{ needs.generate_changelog.outputs.version }} |
| 137 | + BRANCH: ${{ github.ref_name }} |
| 138 | + AWS_TOOLKIT_CHANGES: ${{ needs.generate_changelog.outputs.changes }} |
| 139 | + runs-on: ubuntu-latest |
| 140 | + permissions: |
| 141 | + contents: write |
| 142 | + steps: |
| 143 | + - uses: actions/checkout@v4 |
| 144 | + - uses: actions/download-artifact@v4 |
| 145 | + - name: Delete existing prerelease |
| 146 | + # "prerelease" (main branch) or "pre-<feature>" |
| 147 | + if: "env.TAG_NAME == 'prerelease' || startsWith(env.TAG_NAME, 'pre-')" |
| 148 | + run: | |
| 149 | + echo "SUBJECT=AWS Toolkit ${AWS_TOOLKIT_VERSION}: ${FEAT_NAME:-${TAG_NAME}}" >> $GITHUB_ENV |
| 150 | + gh release delete "$TAG_NAME" --cleanup-tag --yes || true |
| 151 | + - name: Publish to GitHub Releases |
| 152 | + run: | |
| 153 | + envsubst < "$GITHUB_WORKSPACE/.github/workflows/prerelease_notes.md" > "$RUNNER_TEMP/prerelease_notes.md" |
| 154 | + gh release create "$TAG_NAME" --prerelease --notes-file "$RUNNER_TEMP/prerelease_notes.md" --title "$SUBJECT" --target $GITHUB_SHA |
| 155 | + - name: Publish core |
| 156 | + run: | |
| 157 | + gh release upload "$TAG_NAME" plugin-core-*/*.zip |
| 158 | + - name: Publish Q |
| 159 | + run: | |
| 160 | + gh release upload "$TAG_NAME" plugin-amazonq-*/*.zip |
| 161 | + - name: Publish XML manifest |
| 162 | + run: | |
| 163 | + gh release view "$TAG_NAME" --repo "$GITHUB_REPOSITORY" --json assets | python3 "$GITHUB_WORKSPACE/.github/workflows/generateUpdatesXml.py" - > updatePlugins.xml |
| 164 | + gh release upload "$TAG_NAME" updatePlugins.xml |
0 commit comments