Swodlr Deployment #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}"}}' |