-
Notifications
You must be signed in to change notification settings - Fork 2
87 lines (78 loc) · 3.07 KB
/
_featurenet-delete.yml
File metadata and controls
87 lines (78 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
name: FE - Delete
on:
workflow_call:
inputs:
featurenet-name:
description: 'Name of featurenet'
type: string
required: true
jobs:
validate-inputs:
name: Validate inputs
runs-on: ubuntu-24.04
steps:
- name: Validate inputs
shell: bash
# yamllint disable rule:line-length
run: |
if [[
! '${{ inputs.featurenet-name }}' =~ ^[a-z0-9][a-z0-9\-]{4,48}$
]]
then
echo '!!! Invalid featurenet name'
exit 1
fi
# yamllint enable rule:line-length
check-vars-and-secrets:
needs: [validate-inputs]
name: Check vars and secrets
uses: ./.github/workflows/_check-vars-and-secrets.yml
secrets: inherit
delete-featurenet:
needs: [check-vars-and-secrets]
name: Delete featurenet
runs-on: [self-hosted, Linux, X64, small]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Delete featurenet app and data
uses: Cardinal-Cryptography/github-actions/delete-featurenet@v7
with:
gh-ci-user: ${{ secrets.CI_GH_USER }}
gh-ci-token: ${{ secrets.CI_GH_TOKEN }}
aws-access-key-id: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }}
argo-sync-user-token: ${{ secrets.ARGO_SYNC_USER_TOKEN }}
repo-featurenet-template-name: ${{ secrets.REPO_FEATURENET_TEMPLATE_NAME }}
featurenet-name: ${{ inputs.featurenet-name }}
git-commit-author: ${{ secrets.AUTOCOMMIT_AUTHOR }}
git-commit-email: ${{ secrets.AUTOCOMMIT_EMAIL }}
- name: Remove created label if present
uses: actions-ecosystem/action-remove-labels@v1.3.0
if: contains(github.event.pull_request.labels.*.name, 'state:created-featurenet')
with:
labels: 'state:created-featurenet'
github_token: ${{ secrets.CI_GH_TOKEN }}
- name: Delete environment
# yamllint disable-line rule:line-length
if: ${{ matrix.updatenet-gh-env != 'devnet' && matrix.updatenet-gh-env != 'testnet' && matrix.updatenet-gh-env != 'mainnet' }}
uses: Cardinal-Cryptography/github-actions/gh-deployments-environments@v7
with:
action: delete-environment
env: ${{ inputs.featurenet-name }}
token: ${{ secrets.CI_GH_TOKEN }}
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
- name: Remove delete deployment request label if exists
if: contains(github.event.pull_request.labels.*.name, 'trigger:delete-featurenet')
uses: actions-ecosystem/action-remove-labels@v1.3.0
with:
labels: 'trigger:delete-featurenet'
github_token: ${{ secrets.CI_GH_TOKEN }}
- name: Add label to mark that featurenet has been deleted
if: github.event_name == 'pull_request'
uses: actions-ecosystem/action-add-labels@v1.1.3
with:
labels: 'state:deleted-featurenet'
github_token: ${{ secrets.CI_GH_TOKEN }}