-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (49 loc) · 2.08 KB
/
deploy.yaml
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
name: Swodlr Deployment
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
venue:
type: choice
description: Venue to deploy to
options:
- SIT
- UAT
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- uses: getsentry/action-github-app-token@v2
name: my-app-install token
id: podaac-cicd
with:
app_id: ${{ secrets.CICD_APP_ID }}
private_key: ${{ secrets.CICD_APP_PRIVATE_KEY }}
- name: Set venue
run: |
echo "VENUE=${{ github.event.inputs.venue }}">>$GITHUB_ENV
echo "PROJECT_NAME=podaac">>$GITHUB_ENV
- uses: actions/checkout@v4
# Determine the submodule version and hash
- name: Determine Submodule Hash
run: |
SUBMODULE_NAME="swodlr-user-notify"
echo "SUBMODULE_NAME=$SUBMODULE_NAME">>$GITHUB_ENV
GITHUB_LONG_HASH=$(git submodule status|grep $SUBMODULE_NAME|sed -E "s/ swodlr.*//" |sed -E "s/ //g"|sed -E "s/^-//")
echo "GITHUB_LONG_HASH=$GITHUB_LONG_HASH">>$GITHUB_ENV
cd $SUBMODULE_NAME
ls -al
VERSION=$(cat bumpver.toml|grep current_version |grep -v {version} |sed -E "s/current_version = //"|sed -E "s/\"//g")
echo "SUBMODULE_VERSION=$VERSION">>$GITHUB_ENV
- name: Trigger deploy of ${{ env.SUBMODULE_NAME}} version ${{ env.SUBMODULE_VERSION }} [${{ env.GITHUB_LONG_HASH }}] to ${{ env.VENUE }}
run: |
# Set the required variables
repo_owner="${{ env.PROJECT_NAME }}"
repo_name="${{ env.SUBMODULE_NAME }}"
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ steps.podaac-cicd.outputs.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$repo_owner/$repo_name/actions/workflows/build.yml/dispatches \
-d '{"ref":"develop","inputs":{"venue":"${{ env.VENUE }}", "commit":"${{ env.GITHUB_LONG_HASH }}"}}'