70 lines
2.8 KiB
YAML
70 lines
2.8 KiB
YAML
name: "K8S Fission Deployment"
|
|
on:
|
|
push:
|
|
branches: [ 'main' ]
|
|
jobs:
|
|
deployment-fission:
|
|
name: Deployment fission functions
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
FISSION_PROFILE: DEV
|
|
FISSION_VER: 1.21.0
|
|
RAKE_VER: 0.1.3
|
|
steps:
|
|
- name: ☸️ Setup kubectl
|
|
uses: azure/setup-kubectl@v4
|
|
- name: 🔄 Cache
|
|
id: cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
/usr/local/bin/rake
|
|
/usr/local/bin/fission
|
|
key: ${{ runner.os }}-${{ github.event.repository.name }}-${{ hashFiles('.fission/deployment.json') }}
|
|
- name: ☘️ Configure Kubeconfig
|
|
uses: azure/k8s-set-context@v4
|
|
with:
|
|
method: kubeconfig
|
|
kubeconfig: ${{ secrets[format('{0}_KUBECONFIG', env.FISSION_PROFILE)] }}
|
|
- name: 🔄 Install Dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
curl -L "https://${{ secrets.REGISTRY_PASSWORD }}@registry.vegastar.vn/vegacloud/make/releases/download/${RAKE_VER}/rake-${RAKE_VER}-x86_64-unknown-linux-musl.tar.gz" | tar xzv -C /tmp/
|
|
curl -L "https://github.com/fission/fission/releases/download/v${FISSION_VER}/fission-v${FISSION_VER}-linux-amd64" --output /tmp/fission
|
|
install -o root -g root -m 0755 /tmp/rake-${RAKE_VER}-x86_64-unknown-linux-musl/rake /usr/local/bin/rake
|
|
install -o root -g root -m 0755 /tmp/fission /usr/local/bin/fission
|
|
fission check
|
|
# rake cfg install fission -f
|
|
- name: 🕓 Checkout the previous codes
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.before }}
|
|
- name: ♻️ Remove the previous version
|
|
# continue-on-error: true
|
|
run: |
|
|
echo "use profile [$FISSION_PROFILE]"
|
|
mkdir -p manifests || true
|
|
rake sec detail && rake cfm detail && rake env detail && rake pkg detail && rake fn detail && rake ht detail
|
|
rake sp build -fi && rake sp down -i
|
|
- name: 🔎 Checkout repository
|
|
uses: actions/checkout@v4
|
|
- name: ✨ Deploy the new version
|
|
id: deploy
|
|
run: |
|
|
echo "use profile [$FISSION_PROFILE]"
|
|
mkdir -p manifests || true
|
|
rake sec detail && rake cfm detail && rake env detail && rake pkg detail && rake fn detail && rake ht detail
|
|
rake sp build -fi && rake sp up -i
|
|
- name: 🔔 Send notification
|
|
uses: appleboy/telegram-action@master
|
|
if: always()
|
|
with:
|
|
to: ${{ secrets.TELEGRAM_TO }}
|
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
|
format: markdown
|
|
socks5: ${{ secrets.TELEGRAM_PROXY_URL != '' && secrets.TELEGRAM_PROXY_URL || '' }}
|
|
message: |
|
|
${{ steps.deploy.outcome == 'success' && '🟢 (=^ ◡ ^=)' || '🔴 (。•́︿•̀。)' }} Install fn ${{ github.event.repository.name }}
|
|
*Msg*: `${{ github.event.commits[0].message }}`
|