-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (34 loc) · 1.17 KB
/
featureDeploy.yml
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
name: Deploy branch
run-name: Manual deploy to ${{ inputs.environment || 'development' }} by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
environment:
type: environment
description: The environment to deploy to.
jobs:
detect-environments:
runs-on: ubuntu-latest
outputs:
environments: ${{ steps.environments.outputs.result }}
steps:
- uses: actions/github-script@v7
id: environments
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: json
script: |
if (context.payload?.inputs?.environment) return [context.payload?.inputs?.environment];
const {data: {environments}} =
await github.request(`GET /repos/${process.env.GITHUB_REPOSITORY}/environments`);
return environments.map(e => e.name)
deploy-changes:
needs: [detect-environments]
strategy:
matrix:
environment: ${{ fromJSON(needs.detect-environments.outputs.environments) }}
if: ${{ inputs.environment != 'production' }}
uses: ./.github/workflows/deploy.yml
with:
environment: '${{ inputs.environment }}'
secrets: inherit