Build & Release 3.1.5 #22
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 | ||
| run-name: "Build & Release ${{ inputs.version || github.ref_name }}" | ||
| on: | ||
| push: | ||
| tags: ['v*'] | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Release version (e.g., v1.2.3)' | ||
| required: true | ||
| type: string | ||
| force: | ||
| description: 'Force update existing release' | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| env: | ||
| RAW_VERSION: ${{ inputs.version || github.ref_name }} | ||
| REPO_URL: "https://github.com/${{ github.repository }}" | ||
| permissions: | ||
| contents: write | ||
| # packages: write | ||
| # actions: read | ||
| jobs: | ||
| check_version: | ||
| name: "Check if Release Exists" | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| clean_version: ${{ steps.version_logic.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Version & Availability Logic | ||
| id: version_logic | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| # Add 'v' only if it's missing | ||
| [[ "$RAW_VERSION" == v* ]] && VERSION="$RAW_VERSION" || VERSION="v$RAW_VERSION" | ||
| # Validate Format (v1.2.3) | ||
| if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "::error::Invalid format: $VERSION. Use 1.2.3 or v1.2.3" | ||
| exit 1 | ||
| fi | ||
| # Check GitHub for existing release | ||
| if gh release view "$VERSION" >/dev/null 2>&1 && [ "${{ inputs.force }}" != "true" ]; then | ||
| echo "::error::Release $VERSION already exists. Re-run with 'force: true'." | ||
| exit 1 | ||
| fi | ||
| # Export for other jobs | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| build: | ||
| name: Build (${{ matrix.os }}) | ||
| needs: [check_version] | ||
| env: | ||
| VERSION: ${{ needs.check_version.outputs.clean_version }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, 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 | ||
| run: | | ||
| OS=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
| 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: Build Binary | ||
| run: | | ||
| ./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 }} | ||
| publish-docker: | ||
|
Check failure on line 103 in .github/workflows/release.yml
|
||
| needs: [check_version] | ||
| uses: ./.github/workflows/docker.yml | ||
| with: | ||
| version: ${{ needs.check_version.outputs.clean_version }} | ||
| push: false | ||
| secrets: | ||
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| release: | ||
| name: Create Release | ||
| needs: [check_version, build, publish-docker] | ||
| env: | ||
| VERSION: ${{ needs.check_version.outputs.clean_version }} | ||
| runs-on: ubuntu-latest | ||
| 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: | | ||
| # Get previous tag. If none exists, get the first commit | ||
| PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD | tail -n 1) | ||
| cat > manual_notes.md << EOF | ||
| # 🚀 Release ${VERSION} | ||
| ## 📦 Installation | ||
| Install the latest binary for your system instantly: | ||
| \`\`\`bash | ||
| curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/main/tools/installer.sh | bash | ||
| \`\`\` | ||
| ## 🏗️ Available Binaries | ||
| | Platform | Architecture | Binary | | ||
| |----------|--------------|--------| | ||
| | Linux | AMD64 | [awscli-addons-linux-amd64](${REPO_URL}/releases/download/${VERSION}/awscli-addons-linux-amd64) | | ||
| | Linux | ARM64 | [awscli-addons-linux-arm64](${REPO_URL}/releases/download/${VERSION}/awscli-addons-linux-arm64) | | ||
| | macOS (Intel) | AMD64 | [awscli-addons-darwin-amd64](${REPO_URL}/releases/download/${VERSION}/awscli-addons-darwin-amd64) | | ||
| | macOS (Apple Silicon) | ARM64 | [awscli-addons-darwin-arm64](${REPO_URL}/releases/download/${VERSION}/awscli-addons-darwin-arm64) | | ||
| Download the appropriate binary for your platform and make it executable: | ||
| \`\`\`bash | ||
| wget ${REPO_URL}/releases/download/${VERSION}/<Binary> | ||
| chmod +x <Binary> | ||
| sudo mv <Binary> /usr/local/bin/<Binary> | ||
| \`\`\` | ||
| ## 🛡️ Verification | ||
| \`\`\`bash | ||
| # Linux | ||
| sha256sum -c checksums.txt | ||
| # macOS | ||
| shasum -a 256 -c checksums.txt | ||
| \`\`\` | ||
| ## 📋 What's Changed | ||
| EOF | ||
| # Generate changelog between previous tag and current commit | ||
| git log ${PREV_TAG}..HEAD --oneline --pretty=format:"* %s (%h)" >> manual_notes.md | ||
| - name: Force Update Git Tag | ||
| id: update_tag | ||
| if: github.event.inputs.force == 'true' | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git tag -f "$VERSION" | ||
| git push origin "$VERSION" --force | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | ||
| - name: Publish Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ env.VERSION }} | ||
| body_path: manual_notes.md | ||
| files: ./artifacts/* | ||
| append_body: false | ||
| generate_release_notes: true | ||
| make_latest: ${{ github.event.inputs.force == 'true' && 'legacy' || 'true' }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||