-
Notifications
You must be signed in to change notification settings - Fork 40
135 lines (120 loc) · 4 KB
/
deprecate-app.yaml
File metadata and controls
135 lines (120 loc) · 4 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Deprecate App
on:
workflow_dispatch:
inputs:
app:
type: string
description: App Name
required: true
reason:
type: string
description: Deprecation Reason
required: true
release:
type: boolean
description: Create Release
default: true
permissions:
contents: read
jobs:
plan:
name: Plan (${{ inputs.app }})
runs-on: ubuntu-latest
outputs:
pull-number: ${{ steps.pr.outputs.pull-request-number }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Generate Token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
id: app-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
- name: Validate App Directory
env:
APP: ${{ inputs.app }}
run: |-
if [[ ! -d "./apps/${APP}" ]]; then
echo "::error::App directory './apps/${APP}' does not exist"
exit 1
fi
- name: Delete App Directory
env:
APP: ${{ inputs.app }}
run: |-
rm -rf ./apps/${APP}
- name: Create Pull Request
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
id: pr
with:
body: |
**Reason**: ${{ inputs.reason }}
branch: deprecate/${{ inputs.app }}
commit-message: "release(${{ inputs.app }})!: deprecate app image"
sign-commits: true
signoff: true
title: "release(${{ inputs.app }})!: deprecate app image"
token: ${{ steps.app-token.outputs.token }}
merge:
if: ${{ inputs.release }}
name: Merge (${{ inputs.app }})
needs:
- plan
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
id: app-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
- name: Merge Pull Request
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |-
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ needs.plan.outputs.pull-number }},
merge_method: 'squash',
});
announce:
if: ${{ inputs.release }}
name: Announce (${{ inputs.app }})
needs:
- merge
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Generate Token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
id: app-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
- name: Get Release Tag
uses: ./.github/actions/release-tag
id: release
with:
token: ${{ steps.app-token.outputs.token }}
- name: Create Release
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
with:
body: |
> [!WARNING]
> An app has been deprecated and will no longer receive updates.
> After **6 months** from now, its image will be **removed** from our container registry.
## 📦 App
**Name**: ${{ inputs.app }}
**Reason**: ${{ inputs.reason }}
tag: ${{ steps.release.outputs.tag }}
token: ${{ steps.app-token.outputs.token }}