Merge branch 'main' into main #1
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: Release | |
| # Automated release pipeline using Release Please. | |
| # | |
| # How it works: | |
| # 1. You merge PRs to main with conventional commits | |
| # 2. Release Please creates/updates a "Release PR" with version bump | |
| # 3. You review and merge the Release PR | |
| # 4. Tag created, release published, WASM built, notes rebuilt with | |
| # ALL commit types + contributors + full changelog link | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| release-type: simple | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| build-artifacts: | |
| needs: release-please | |
| if: needs.release-please.outputs.release_created == 'true' | |
| runs-on: ubuntu-latest | |
| env: | |
| TAG: ${{ needs.release-please.outputs.tag_name }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install stellar-cli | |
| run: | | |
| curl -fsSL https://github.com/stellar/stellar-cli/releases/download/v25.2.0/stellar-cli-25.2.0-x86_64-unknown-linux-gnu.tar.gz \ | |
| | tar xz -C /usr/local/bin | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: wasm32-unknown-unknown,wasm32v1-none | |
| - name: Build optimized WASM contracts | |
| run: stellar contract build | |
| - name: Upload WASM binaries to release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| for wasm in target/wasm32v1-none/release/*.wasm; do | |
| [ -f "$wasm" ] || continue | |
| gh release upload "$TAG" "$wasm" --clobber | |
| echo "Uploaded: $(basename $wasm)" | |
| done | |
| - name: Rebuild release notes | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| HEAD_SHA=$(git rev-parse HEAD) | |
| PREV_TAG=$(git tag --sort=-v:refname | grep -v "^${TAG}$" | head -1 2>/dev/null || echo "") | |
| if [ -n "$PREV_TAG" ]; then | |
| RANGE="${PREV_TAG}..${TAG}" | |
| else | |
| RANGE="${TAG}" | |
| fi | |
| # Build changelog using external script (avoids YAML escaping) | |
| git log "$RANGE" --pretty=format:"%s (%h)" --no-merges 2>/dev/null | \ | |
| grep -v "^chore(main): release" > /tmp/commits.txt || true | |
| CHANGELOG=$(bash .github/scripts/categorize-commits.sh) | |
| # Resolve contributors | |
| cat > /tmp/contributors.jq << 'JQ_FILTER' | |
| [ | |
| .[] | | |
| select(.author != null) | | |
| select(.author.login != "dependabot[bot]") | | |
| select(.author.login != "web-flow") | | |
| select(.author.login != "github-actions[bot]") | | |
| { login: .author.login, name: .commit.author.name } | |
| ] | | |
| unique_by(.login) | | |
| .[] | | |
| "- **\(.name)** ([@\(.login)](https://github.com/\(.login)))" | |
| JQ_FILTER | |
| gh api "repos/${GITHUB_REPOSITORY}/commits" \ | |
| -X GET -f per_page=100 -f sha="${HEAD_SHA}" \ | |
| > /tmp/commits_api.json 2>/dev/null || echo "[]" > /tmp/commits_api.json | |
| CONTRIBUTORS=$(jq -r -f /tmp/contributors.jq /tmp/commits_api.json 2>/dev/null || echo "") | |
| # Build release body | |
| { | |
| echo "## ${TAG}" | |
| echo "" | |
| echo "$CHANGELOG" | |
| if [ -n "$CONTRIBUTORS" ]; then | |
| echo "## Contributors" | |
| echo "" | |
| echo "Thank you to everyone who contributed to this release:" | |
| echo "" | |
| echo "$CONTRIBUTORS" | |
| fi | |
| echo "" | |
| echo "---" | |
| echo "" | |
| if [ -n "$PREV_TAG" ]; then | |
| echo "**[View all code changes since ${PREV_TAG}](https://github.com/${GITHUB_REPOSITORY}/compare/${PREV_TAG}...${TAG})**" | |
| else | |
| echo "**[View all commits](https://github.com/${GITHUB_REPOSITORY}/commits/${TAG})**" | |
| fi | |
| } > /tmp/release_body.md | |
| echo "=== Release notes ===" | |
| cat /tmp/release_body.md | |
| echo "=== End ===" | |
| gh release edit "$TAG" --notes-file /tmp/release_body.md |