-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (107 loc) · 3.63 KB
/
fireway-migrate.yml
File metadata and controls
117 lines (107 loc) · 3.63 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
name: fireway migrate
on:
workflow_call:
inputs:
workload-identity-project-number:
description: the GCP project number used for Workload Identity Federation
required: true
type: string
gcp-project-id:
description: The firebase project environment used for the deployment
required: true
type: string
gcp-service-account:
description: the email address of the service account
required: true
type: string
working-directory:
description: The working directory of the firebase project
required: false
type: string
default: functions
dry-run:
description: run migrations in dry-run mode
type: boolean
required: false
default: false
slack-channel-id:
description: Slack channel id to send alerts to
type: string
required: false
concurrency:
group: fireway-migrate-${{ inputs.gcp-project-id }}
jobs:
fireway:
name: fireway
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .tool-versions
cache: npm
cache-dependency-path: package-lock.json
- name: install dependencies
run: npm ci
- uses: valian-ca/github-workflows/.github/actions/gcp-github-auth@main
with:
workload-identity-project-number: ${{ inputs.workload-identity-project-number }}
gcp-service-account: ${{ inputs.gcp-service-account }}
- uses: google-github-actions/setup-gcloud@v3
with:
project_id: ${{ inputs.gcp-project-id }}
- name: configure firebase environment
run: npx firebase use ${{ inputs.gcp-project-id }}
working-directory: ${{ inputs.working-directory }}
- name: run migrations - dry run
env:
GCLOUD_PROJECT: ${{ inputs.gcp-project-id }}
if: ${{ inputs.dry-run }}
run: npx fireway migrate --require="ts-node/register" --dryRun
working-directory: ${{ inputs.working-directory }}
- name: run migrations
env:
GCLOUD_PROJECT: ${{ inputs.gcp-project-id }}
if: ${{ ! inputs.dry-run }}
run: npx fireway migrate --require="ts-node/register"
working-directory: ${{ inputs.working-directory }}
- name: notify Slack of failure
id: slack
if: ${{ !success() && inputs.slack-channel-id != '' }}
uses: slackapi/slack-github-action@v3.0.3
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
{
"channel": "${{ inputs.slack-channel-id }}",
"text": "Fireway Migration Problem (${{ job.status }})",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Fireway Migration Problem"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":x: ${{ inputs.github-environment }} migration ${{ job.status }}"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
]
}
]
}