Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.5.0 to main #539

Merged
merged 7 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions .github/workflows/automated_release_process.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Automated Release Process

permissions:
contents: write
pull-requests: write
issues: write

on:
workflow_dispatch:
inputs:
version:
description: "Release version (x.y.z or x.y.z-rc.1)"
required: true
type: string

env:
REPO_ORG: stellar
REPO_NAME: stellar-disbursement-platform-backend
REVIEWER: marcelosalloum,marwen-abid

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Validate version format
run: |
if ! [[ ${{ inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)\.[0-9]+)?$ ]]; then
echo "Error: Version must be in format x.y.z or x.y.z-rc.n"
echo "Examples:"
echo " 1.2.3"
echo " 1.2.3-rc.1"
exit 1
fi

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup GitHub CLI
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token

- name: Configure Git User
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

- name: Create release/${{ inputs.version }} branch
run: |
git checkout -b release/${{ inputs.version }} origin/${{ github.ref_name }}
sed -i 's/const Version = ".*"/const Version = "${{ inputs.version }}"/' main.go
git add main.go
git commit -m "chore: bump version to ${{ inputs.version }}"
git push origin release/${{ inputs.version }}

- name: Create main PR
id: create_main_pr
run: |
MAIN_PR_URL=$(sed "s/{{version}}/${{ inputs.version }}/g" .github/workflows/templates/release-pr-main.md | \
gh pr create --repo ${{ env.REPO_ORG }}/${{ env.REPO_NAME }} \
--base main \
--head release/${{ inputs.version }} \
--title "Release \`${{ inputs.version }}\` to \`main\`" \
--body-file - \
--assignee "${{ github.actor }}" \
--reviewer "${{ env.REVIEWER }}")
echo "main_pr_url=${MAIN_PR_URL}" >> $GITHUB_OUTPUT

- name: Create release/${{ inputs.version }}-dev branch
run: |
git checkout -b release/${{ inputs.version }}-dev release/${{ inputs.version }}
git push origin release/${{ inputs.version }}-dev

- name: Create develop PR
id: create_dev_pr
run: |
DEV_PR_URL=$(sed -e "s/{{version}}/${{ inputs.version }}/g" \
-e "s|{{ main_pr_url }}|${{ steps.create_main_pr.outputs.main_pr_url }}|g" \
.github/workflows/templates/release-pr-dev.md | \
gh pr create --repo ${{ env.REPO_ORG }}/${{ env.REPO_NAME }} \
--base develop \
--head release/${{ inputs.version }}-dev \
--title "Release \`${{ inputs.version }}\` to \`dev\`" \
--body-file - \
--assignee "${{ github.actor }}" \
--reviewer "${{ env.REVIEWER }}")
echo "dev_pr_url=${DEV_PR_URL}" >> $GITHUB_OUTPUT

- name: Create Draft Release
id: create_release
run: |
RELEASE_URL=$(gh release create ${{ inputs.version }} \
--title "${{ inputs.version }}" \
--draft \
--notes "Initial draft for release \`${{ inputs.version }}\`")
echo "release_url=${RELEASE_URL}" >> $GITHUB_OUTPUT

- name: Create Issue
id: create_issue
run: |
ISSUE_URL=$(sed -e "s/{{version}}/${{ inputs.version }}/g" \
-e "s|{{ main_pr_url }}|${{ steps.create_main_pr.outputs.main_pr_url }}|g" \
-e "s|{{ dev_pr_url }}|${{ steps.create_dev_pr.outputs.dev_pr_url }}|g" \
-e "s|{{ release_url }}|${{ steps.create_release.outputs.release_url }}|g" \
.github/workflows/templates/release-issue.md | \
gh issue create \
--title "Release \`${{ inputs.version }}\`" \
--body-file - \
--label "release" \
--assignee "${{ github.actor }}")
echo "issue_url=${ISSUE_URL}" >> $GITHUB_OUTPUT

- name: Print Summary
run: |
echo "Release Process Summary for ${{ inputs.version }}"
echo "----------------------------------------"
echo "Issue: ${{ steps.create_issue.outputs.issue_url }}"
echo "Main PR: ${{ steps.create_main_pr.outputs.main_pr_url }}"
echo "Dev PR: ${{ steps.create_dev_pr.outputs.dev_pr_url }}"
echo "Draft Release: ${{ steps.create_release.outputs.release_url }}"
23 changes: 23 additions & 0 deletions .github/workflows/templates/release-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Release `{{version}}`

## Release Checklist

### Git Preparation

- [x] Create release branch `release/{{version}}` from `develop`
- [x] Create pull requests:
- Main PR: {{ main_pr_url }}
- Dev PR: {{ dev_pr_url }}

### Code Preparation

- [ ] Run tests and linting
- [ ] Complete the checklist and merge the main PR: {{ main_pr_url }}
- [ ] Complete the checklist and merge the dev PR: {{ dev_pr_url }}
- [ ] 🚨 DO NOT RELEASE before holidays or weekends! Mondays and Tuesdays are preferred.

### Publishing the Release

- [ ] After the main PR is merged, publish the draft release: {{ release_url }} -> [Release Page](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/{{version}})
- [ ] Verify the Docker image is published to [Docker Hub](https://hub.docker.com/r/stellar/stellar-disbursement-platform-backend/tags)
- [ ] Propagate the helmchart version update to the [stellar/helm-charts](https://github.com/stellar/helm-charts) repository
7 changes: 7 additions & 0 deletions .github/workflows/templates/release-pr-dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Release `{{version}}` to `dev`

### Pending

- [ ] Merge the main PR {{ main_pr_url }}
- [ ] Rebase this branch onto `main`
- [ ] 🚨 Merge this PR using the **`Merge pull request`** button
11 changes: 11 additions & 0 deletions .github/workflows/templates/release-pr-main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Release `{{version}}` to `main`

### Pending

- [x] Bump version in main.go
- [ ] Update CHANGELOG.md
- [ ] Bump version in helmchart/sdp/Chart.yaml
- [ ] Bump backend version in helmchart/sdp/values.yaml
- [ ] Bump frontend version in helmchart/sdp/values.yaml
- [ ] Regenerate the helm charts README.md with `readme-generator -v values.yaml -r README.md`
- [ ] 🚨 Merge this PR using the **`Merge pull request`** button
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/).

## [3.5.0](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/3.5.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/3.4.0...3.5.0))

> [!WARNING]
> This version is compatible with the [stellar/stellar-disbursement-platform-frontend] version `3.5.0`.

### Added

- Added short linking for Wallet Registration Links.
[#523](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/523)
- Added a new `is_link_shortener_enabled` property to `GET` and `PATCH` organizations endpoints to enable/disable the short link feature.
[#523](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/523)
- Added receiver contact info for Payments export.
[#538](https://github.com/stellar/stellar-disbursement-platform-frontend/pull/538)


## [3.4.0](https://github.com/stellar/stellar-disbursement-platform-backend/releases/tag/3.4.0) ([diff](https://github.com/stellar/stellar-disbursement-platform-backend/compare/3.3.0...3.4.0))

Release of the Stellar Disbursement Platform `v3.4.0`. This release adds support for `q={term}` query searches in the
Expand Down
20 changes: 20 additions & 0 deletions db/migrations/sdp-migrations/2025-01-30.0-add-short-urls-table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- Add auditing to receiver_verifications

-- +migrate Up
CREATE TABLE short_urls (
id VARCHAR(10) PRIMARY KEY,
original_url TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

CREATE UNIQUE INDEX short_urls_original_url_idx ON short_urls (original_url);

ALTER TABLE organizations
ADD COLUMN is_link_shortener_enabled boolean NOT NULL DEFAULT false;


-- +migrate Down
DROP TABLE short_urls;

ALTER TABLE organizations
DROP COLUMN is_link_shortener_enabled;
4 changes: 2 additions & 2 deletions helmchart/sdp/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: stellar-disbursement-platform
description: A Helm chart for the Stellar Disbursement Platform Backend (A.K.A. `sdp`)
version: "3.3.0"
appVersion: "3.4.0"
version: "3.5.0"
appVersion: "3.5.0"
type: application
maintainers:
- name: Stellar Development Foundation
Expand Down
4 changes: 2 additions & 2 deletions helmchart/sdp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Configuration parameters for the SDP Core Service which is the core backend serv
| `sdp.image` | Configuration related to the Docker image used by the SDP service. | |
| `sdp.image.repository` | Docker image repository for the SDP backend service. | `stellar/stellar-disbursement-platform-backend` |
| `sdp.image.pullPolicy` | Image pull policy for the SDP service. For locally built images, consider using "Never" or "IfNotPresent". | `Always` |
| `sdp.image.tag` | Docker image tag for the SDP service. If set, this overrides the default value from `.Chart.AppVersion`. | `3.4.0` |
| `sdp.image.tag` | Docker image tag for the SDP service. If set, this overrides the default value from `.Chart.AppVersion`. | `3.5.0` |
| `sdp.deployment` | Configuration related to the deployment of the SDP service. | |
| `sdp.deployment.annotations` | Annotations to be added to the deployment. | `nil` |
| `sdp.deployment.podAnnotations` | Annotations specific to the pods. | `{}` |
Expand Down Expand Up @@ -291,7 +291,7 @@ Configuration parameters for the Dashboard. This is the user interface administr
| `dashboard.route.mtnDomain` | Public domain/address of the multi-tenant Dashboard. This is a wild-card domain used for multi-tenant setups e.g. "*.sdp-dashboard.localhost.com". | `nil` |
| `dashboard.route.port` | Primary port on which the Dashboard listens. | `80` |
| `dashboard.image` | Configuration related to the Docker image used by the Dashboard. | |
| `dashboard.image.fullName` | Full name of the Docker image. | `stellar/stellar-disbursement-platform-frontend:3.4.0` |
| `dashboard.image.fullName` | Full name of the Docker image. | `stellar/stellar-disbursement-platform-frontend:3.5.0` |
| `dashboard.image.pullPolicy` | Image pull policy for the dashboard. For locally built images, consider using "Never" or "IfNotPresent". | `Always` |
| `dashboard.deployment` | Configuration related to the deployment of the Dashboard. | |
| `dashboard.deployment.annotations` | Annotations to be added to the deployment. | `{}` |
Expand Down
4 changes: 2 additions & 2 deletions helmchart/sdp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ sdp:
image:
repository: stellar/stellar-disbursement-platform-backend
pullPolicy: Always
tag: "3.4.0"
tag: "3.5.0"

## @extra sdp.deployment Configuration related to the deployment of the SDP service.
## @param sdp.deployment.annotations Annotations to be added to the deployment.
Expand Down Expand Up @@ -536,7 +536,7 @@ dashboard:
## @param dashboard.image.fullName Full name of the Docker image.
## @param dashboard.image.pullPolicy Image pull policy for the dashboard. For locally built images, consider using "Never" or "IfNotPresent".
image:
fullName: stellar/stellar-disbursement-platform-frontend:3.4.0
fullName: stellar/stellar-disbursement-platform-frontend:3.5.0
pullPolicy: Always

## @extra dashboard.deployment Configuration related to the deployment of the Dashboard.
Expand Down
9 changes: 9 additions & 0 deletions internal/data/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,15 @@ func CreateMockImage(t *testing.T, width, height int, size ImageSize) image.Imag
return img
}

func CreateShortURLFixture(t *testing.T, ctx context.Context, sqlExec db.SQLExecuter, shortCode, url string) {
const query = `
INSERT INTO short_urls (id, original_url)
VALUES ($1, $2)
`
_, err := sqlExec.ExecContext(ctx, query, shortCode, url)
require.NoError(t, err)
}

func DeleteAllFixtures(t *testing.T, ctx context.Context, sqlExec db.SQLExecuter) {
DeleteAllMessagesFixtures(t, ctx, sqlExec)
DeleteAllPaymentsFixtures(t, ctx, sqlExec)
Expand Down
42 changes: 42 additions & 0 deletions internal/data/mocks/code_generator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions internal/data/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Models struct {
Message *MessageModel
CircleTransferRequests *CircleTransferRequestModel
CircleRecipient *CircleRecipientModel
URLShortener *URLShortenerModel
DBConnectionPool db.DBConnectionPool
}

Expand All @@ -48,6 +49,7 @@ func NewModels(dbConnectionPool db.DBConnectionPool) (*Models, error) {
Message: &MessageModel{dbConnectionPool: dbConnectionPool},
CircleTransferRequests: &CircleTransferRequestModel{dbConnectionPool: dbConnectionPool},
CircleRecipient: &CircleRecipientModel{dbConnectionPool: dbConnectionPool},
URLShortener: NewURLShortenerModel(dbConnectionPool),
DBConnectionPool: dbConnectionPool,
}, nil
}
8 changes: 8 additions & 0 deletions internal/data/organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Organization struct {
PrivacyPolicyLink *string `json:"privacy_policy_link" db:"privacy_policy_link"`
Logo []byte `db:"logo"`
IsApprovalRequired bool `json:"is_approval_required" db:"is_approval_required"`
IsLinkShortenerEnabled bool `json:"is_link_shortener_enabled" db:"is_link_shortener_enabled"`
MessageChannelPriority MessageChannelPriority `json:"message_channel_priority" db:"message_channel_priority"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
Expand All @@ -58,6 +59,7 @@ type OrganizationUpdate struct {
Logo []byte `json:",omitempty"`
TimezoneUTCOffset string `json:",omitempty"`
IsApprovalRequired *bool `json:",omitempty"`
IsLinkShortenerEnabled *bool `json:",omitempty"`
ReceiverInvitationResendIntervalDays *int64 `json:",omitempty"`
PaymentCancellationPeriodDays *int64 `json:",omitempty"`

Expand Down Expand Up @@ -126,6 +128,7 @@ func (ou *OrganizationUpdate) areAllFieldsEmpty() bool {
len(ou.Logo) == 0 &&
ou.TimezoneUTCOffset == "" &&
ou.IsApprovalRequired == nil &&
ou.IsLinkShortenerEnabled == nil &&
ou.ReceiverRegistrationMessageTemplate == nil &&
ou.OTPMessageTemplate == nil &&
ou.ReceiverInvitationResendIntervalDays == nil &&
Expand Down Expand Up @@ -197,6 +200,11 @@ func (om *OrganizationModel) Update(ctx context.Context, ou *OrganizationUpdate)
args = append(args, *ou.IsApprovalRequired)
}

if ou.IsLinkShortenerEnabled != nil {
fields = append(fields, "is_link_shortener_enabled = ?")
args = append(args, *ou.IsLinkShortenerEnabled)
}

if ou.ReceiverRegistrationMessageTemplate != nil {
if *ou.ReceiverRegistrationMessageTemplate != "" {
fields = append(fields, "receiver_registration_message_template = ?")
Expand Down
1 change: 1 addition & 0 deletions internal/data/query_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
type FilterKey string

const (
FilterKeyIDs FilterKey = "ids"
FilterKeyStatus FilterKey = "status"
FilterKeyReceiverID FilterKey = "receiver_id"
FilterKeyPaymentID FilterKey = "payment_id"
Expand Down
4 changes: 4 additions & 0 deletions internal/data/receivers.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ func newReceiverQuery(baseQuery string, queryParams *QueryParams, sqlExec db.SQL
q := "%" + queryParams.Query + "%"
qb.AddCondition("(r.id ILIKE ? OR r.phone_number ILIKE ? OR r.email ILIKE ?)", q, q, q)
}
if queryParams.Filters[FilterKeyIDs] != nil {
ids := queryParams.Filters[FilterKeyIDs].([]string)
qb.AddCondition("r.id = ANY(?)", pq.Array(ids))
}
if queryParams.Filters[FilterKeyStatus] != nil {
status := queryParams.Filters[FilterKeyStatus].(ReceiversWalletStatus)
qb.AddCondition("rw.status = ?", status)
Expand Down
Loading