Skip to content

Commit 67335eb

Browse files
committed
create a channel before releasing
1 parent 71cb017 commit 67335eb

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/wg-easy-pr-validation.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@ jobs:
197197
- name: Install Replicated CLI
198198
run: task utils:install-replicated-cli
199199

200+
- name: Create channel for branch
201+
run: |
202+
BRANCH_NAME="${{ github.head_ref || github.ref_name }}"
203+
CHANNEL_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
204+
task channel-create CHANNEL_NAME="$CHANNEL_NAME"
205+
timeout-minutes: 5
206+
env:
207+
REPLICATED_API_TOKEN: ${{ secrets.WG_EASY_REPLICATED_API_TOKEN }}
208+
REPLICATED_APP: ${{ secrets.WG_EASY_REPLICATED_APP }}
209+
200210
- name: Run replicated-release task
201211
run: |
202212
BRANCH_NAME="${{ github.head_ref || github.ref_name }}"

applications/wg-easy/Taskfile.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,50 @@ tasks:
533533
# Confirm archiving
534534
echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived"
535535
536+
channel-create:
537+
desc: Create a Replicated release channel
538+
silent: false
539+
vars:
540+
CHANNEL_NAME: '{{.CHANNEL_NAME}}'
541+
requires:
542+
vars: [APP_SLUG, CHANNEL_NAME]
543+
cmds:
544+
- echo "Creating channel {{.CHANNEL_NAME}} for app {{.APP_SLUG}}..."
545+
- |
546+
# Check if channel already exists
547+
EXISTING_CHANNEL=$(replicated channel ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.CHANNEL_NAME}}") | .name' | head -1)
548+
549+
if [ -n "$EXISTING_CHANNEL" ]; then
550+
echo "Channel {{.CHANNEL_NAME}} already exists for app {{.APP_SLUG}}"
551+
exit 0
552+
fi
553+
554+
# Create the channel
555+
replicated channel create --app {{.APP_SLUG}} --name {{.CHANNEL_NAME}}
556+
echo "Channel {{.CHANNEL_NAME}} created successfully"
557+
558+
channel-delete:
559+
desc: Archive a Replicated release channel
560+
silent: false
561+
vars:
562+
CHANNEL_NAME: '{{.CHANNEL_NAME}}'
563+
requires:
564+
vars: [APP_SLUG, CHANNEL_NAME]
565+
cmds:
566+
- echo "Archiving channel {{.CHANNEL_NAME}} for app {{.APP_SLUG}}..."
567+
- |
568+
# Get channel ID
569+
CHANNEL_ID=$(replicated channel ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.CHANNEL_NAME}}") | .id' | head -1)
570+
571+
if [ -z "$CHANNEL_ID" ]; then
572+
echo "Error: Channel {{.CHANNEL_NAME}} not found for app {{.APP_SLUG}}"
573+
exit 1
574+
fi
575+
576+
# Archive the channel
577+
replicated channel archive --app {{.APP_SLUG}} $CHANNEL_ID
578+
echo "Channel {{.CHANNEL_NAME}} (ID: $CHANNEL_ID) archived successfully"
579+
536580
clean:
537581
desc: Remove temporary Helm directories, chart dependencies, and release folder
538582
silent: false

0 commit comments

Comments
 (0)