Skip to content

Merge master into feature/sdkv3 #5164

Merge master into feature/sdkv3

Merge master into feature/sdkv3 #5164

Workflow file for this run

# This job performs the following:
# - Publish prerelease (not release) artifacts for feature/x branches and "nightly" mainline.
name: Prerelease
on:
# schedule:
# - cron: '5 5 * * *'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: prerelease
push:
branches: [master, feature/*]
# tags:
# - v[0-9]+.[0-9]+.[0-9]+
jobs:
package:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max-old-space-size=8192'
outputs:
feature: ${{ steps.build.outputs.feature }}
tagname: ${{ steps.build.outputs.tagname }}
toolkit_version: ${{ steps.build.outputs.toolkit_version }}
amazonq_version: ${{ steps.build.outputs.amazonq_version }}
toolkit_changes: ${{ steps.build.outputs.toolkit_changes }}
amazonq_changes: ${{ steps.build.outputs.amazonq_changes }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# - if: github.event_name == 'schedule'
# run: echo 'TAG_NAME=prerelease' >> $GITHUB_ENV
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.ref_name != 'master'
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 == 'master'
run: |
echo "FEAT_NAME=" >> $GITHUB_ENV
echo "TAG_NAME=prerelease" >> $GITHUB_ENV
- run: npm ci
- name: vsix
run: |
npm run createRelease -w packages/toolkit -w packages/amazonq # Generate CHANGELOG.md
npm run -w packages/toolkit package -- --feature "$FEAT_NAME"
npm run -w packages/amazonq package -- --feature "$FEAT_NAME"
- uses: actions/upload-artifact@v4
with:
name: artifacts
path: '*.vsix'
retention-days: 10
- name: Export outputs
id: build
run: |
write_package_info() {
PKG_NAME=$1
PKG_DISPLAY_NAME=$(grep -m 1 displayName packages/${PKG_NAME}/package.json | grep -o '[a-zA-z][^\"]\+' | tail -n1)
echo "${PKG_NAME}_version=$(grep -m 1 version packages/${PKG_NAME}/package.json | grep -o '[0-9][^\"]\+' | sed 's/-SNAPSHOT//')" >> $GITHUB_OUTPUT
echo "${PKG_NAME}_changes<<EOF" >> $GITHUB_OUTPUT
# Add extension display name to the topmost changelog section.
cat packages/${PKG_NAME}/CHANGELOG.md | perl -ne 'BEGIN{$/="\n\n"} print; exit if $. == 2' | sed -e "1 s/## /## ${PKG_DISPLAY_NAME} - /" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
}
echo "feature=$FEAT_NAME" >> $GITHUB_OUTPUT
echo "tagname=$TAG_NAME" >> $GITHUB_OUTPUT
write_package_info toolkit
write_package_info amazonq
publish:
needs: [package]
runs-on: ubuntu-latest
env:
#
# For `gh`.
#
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FEAT_NAME: ${{ needs.package.outputs.feature }}
TAG_NAME: ${{ needs.package.outputs.tagname }}
AWS_TOOLKIT_VERSION: ${{ needs.package.outputs.toolkit_version }}
AMAZON_Q_VERSION: ${{ needs.package.outputs.amazonq_version }}
#
# Used in release_notes.md
#
BRANCH: ${{ github.ref_name }}
AWS_TOOLKIT_CHANGES: ${{ needs.package.outputs.toolkit_changes }}
AMAZON_Q_CHANGES: ${{ needs.package.outputs.amazonq_changes }}
permissions:
contents: write
steps:
# Must perform checkout first, it deletes the target directory
# before running, thus would delete the downloaded artifacts.
- 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 IDE Extensions: ${FEAT_NAME:-${TAG_NAME}}" >> $GITHUB_ENV
gh release delete "$TAG_NAME" --cleanup-tag --yes || true
# git push origin :"$TAG_NAME" || true
- name: Publish Prerelease
run: |
# AWS_TOOLKIT_CHANGES="$(head -14 CHANGELOG.md)"
envsubst < "$GITHUB_WORKSPACE/.github/workflows/release_notes.md" > "$RUNNER_TEMP/release_notes.md"
gh release create $TAG_NAME --prerelease --notes-file "$RUNNER_TEMP/release_notes.md" --title "$SUBJECT" --target $GITHUB_SHA artifacts/*