Skip to content

Commit

Permalink
feat: adjust cd
Browse files Browse the repository at this point in the history
  • Loading branch information
mhdramadhanarvin committed Sep 12, 2024
1 parent ad444ab commit 6168933
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ jobs:
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, redis
coverage: none

- name: Copy credentials Google Api
- name: Decrypt large secret
run: ./decrypt_secret.sh
env:
SECRET_PASSPHRASE: ${{ secrets.CRENDENTIALS_PASSPHRASE }}
run: |
cp .env.example .env && \
gpg --quiet --batch --yes --decrypt --passphrase="$SECRET_PASSPHRASE" --output ./storage/app/credentials.json credentials.json.gpg
LARGE_SECRET_PASSPHRASE: ${{ secrets.CRENDENTIALS_PASSPHRASE }}

- name: Run composer install
run: composer install -n --prefer-dist -o
Expand Down
32 changes: 26 additions & 6 deletions app/Filament/Resources/PartnerResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,38 @@ class PartnerResource extends Resource

public static function getPluralLabel(): string
{
return __('Toko');
$user = User::find(Auth::id());
if ($user->hasRole('partner')) {
$naming = "Toko";
} else {
$naming = "Mitra";
}
return __($naming);
}

public static function getModelLabel(): string
{
return __('Toko');
$user = User::find(Auth::id());
if ($user->hasRole('partner')) {
$naming = "Toko";
} else {
$naming = "Mitra";
}
return __($naming);
}

public static function form(Form $form): Form
{
$user = User::find(Auth::id());
if ($user->hasRole('partner')) {
$naming = "Toko";
} else {
$naming = "Mitra";
}
return $form
->schema([
TextInput::make('name')->label('Nama Toko')->required(),
TextInput::make('address')->label('Alamat Toko')->required(),
TextInput::make('name')->label('Nama ' . $naming)->required(),
TextInput::make('address')->label('Alamat ' .$naming)->required(),
Select::make('sector')->label('Sektor')->options(PartnerEnum::class)->required(),
Select::make('is_active')
->label('Status')
Expand All @@ -59,11 +76,14 @@ public static function table(Table $table): Table
$isLocked = false;
if ($user->hasRole('partner')) {
$isLocked = $user->partner->is_active;
$naming = "Toko";
} else {
$naming = "Mitra";
}
return $table
->columns([
TextColumn::make('name')->label('Nama Toko'),
TextColumn::make('address')->label('Alamat Toko')->limit(60),
TextColumn::make('name')->label('Nama ' . $naming),
TextColumn::make('address')->label('Alamat ' . $naming)->limit(60),
TextColumn::make('sector')->label('Sektor')->badge(),
TextColumn::make('is_active')
->label('Status')
Expand Down
Binary file modified credentials.json.gpg
Binary file not shown.
8 changes: 8 additions & 0 deletions decrypt_secret.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

# Decrypt the file
# mkdir $HOME/secrets
# --batch to prevent interactive command
# --yes to assume "yes" for questions
gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" \
--output ./storage/app/credentials.json ./credentials.json.gpg

0 comments on commit 6168933

Please sign in to comment.