Build & Release AWSCLI-Addons #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Release AWSCLI-Addons | |
| on: | |
| push: | |
| tags: ['v*'] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g., v1.2.3)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| packages: write | |
| actions: read | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, ubuntu-24.04-arm64, macos-13, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: 'pip' | |
| - name: Detect OS and ARCH | |
| id: info | |
| shell: bash | |
| run: | | |
| # Detect OS (linux, darwin) | |
| OS=$(uname -s | tr '[:upper:]' '[:lower:]') | |
| # Detect Arch (amd64, arm64) | |
| ARCH=$(uname -m) | |
| [ "$ARCH" == "x86_64" ] && ARCH="amd64" | |
| [ "$ARCH" == "aarch64" ] && ARCH="arm64" | |
| # Set the output variable | |
| echo "artifact_name=awscli-addons-${OS}-${ARCH}" >> $GITHUB_OUTPUT | |
| - name: Run Build Script | |
| shell: bash | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| ./tools/build.sh quick "${VERSION}" | |
| # Move the binary to the unique name defined above | |
| mv dist/awscli-addons "dist/${{ steps.info.outputs.artifact_name }}" | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.info.outputs.artifact_name }} | |
| path: dist/${{ steps.info.outputs.artifact_name }} | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| pattern: awscli-addons-* | |
| merge-multiple: true | |
| - name: Generate checksums | |
| run: | | |
| cd artifacts | |
| sha256sum awscli-addons-* > checksums.txt | |
| cat checksums.txt | |
| - name: Create Manual Instructions | |
| id: manual_notes | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| FILE_NAME="manual_notes.md" | |
| # Get previous tag or default to first commit | |
| PREV_TAG=$(git describe --tags --abbrev=0 "${VERSION}^" 2>/dev/null || git rev-list --max-parents=0 HEAD) | |
| REPO_URL="https://github.com/${{ github.repository }}" | |
| cat > ${FILE_NAME} << EOF | |
| # π Release ${VERSION} | |
| ## π¦ Installation | |
| Install the latest binary for your system instantly: | |
| \`\`\`bash | |
| curl -sSL https://raw.githubusercontent.com{{ github.repository }}/main/install.sh | bash | |
| \`\`\` | |
| ## ποΈ Available Binaries | |
| | Platform | Architecture | Binary | | |
| |----------|--------------|--------| | |
| | Linux | AMD64 | [linux-amd64](${REPO_URL}/releases/download/${VERSION}/awscli-addons-linux-amd64) | | |
| | Linux | ARM64 | [linux-arm64](${REPO_URL}/releases/download/${VERSION}/awscli-addons-linux-arm64) | | |
| | macOS | AMD64 | [macos-amd64](${REPO_URL}/releases/download/${VERSION}/awscli-addons-macos-amd64) | | |
| | macOS | ARM64 | [macos-arm64](${REPO_URL}/releases/download/${VERSION}/awscli-addons-macos-arm64) | | |
| Download the appropriate binary for your platform and make it executable: | |
| \`\`\`bash | |
| wget ${REPO_URL}/releases/download/${VERSION}/<Binary> | |
| #or | |
| curl ${REPO_URL}/releases/download/${VERSION}/<Binary> | |
| chmod +x <Binary> | |
| sudo mv <Binary> /usr/local/bin/<Binary> | |
| \`\`\` | |
| ## π‘οΈ Verification | |
| \`\`\`bash | |
| sha256sum -c checksums.txt | |
| \`\`\` | |
| ## π What's Changed | |
| EOF | |
| if [ -n "$PREV_TAG" ]; then | |
| git log ${PREV_TAG}..${VERSION} --oneline --pretty=format:"* %s (%h)" >> ${FILE_NAME} | |
| else | |
| echo "Initial release" >> ${FILE_NAME} | |
| fi | |
| - name: Publish Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| body_path: manual_notes.md | |
| append_body: true # β This attaches GitHub's notes BELOW yours | |
| generate_release_notes: true # β This triggers the auto-generation | |
| files: | | |
| ./artifacts/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # - name: Create or update GitHub Release | |
| # uses: ncipollo/release-action@v1 | |
| # with: | |
| # tag: latest | |
| # name: Latest Release | |
| # draft: false | |
| # prerelease: false | |
| # artifacts: dist/* |