Skip to content

Commit

Permalink
Merge pull request #9 from nextmv-io/feature/eng-4446-move-marketplac…
Browse files Browse the repository at this point in the history
…e-app-update-workflow-to-community-apps-repo

ENG-4446 Update marketplace apps in Cloud
  • Loading branch information
sebastian-quintero authored Feb 9, 2024
2 parents fc3e168 + b7558e3 commit 2c99dce
Show file tree
Hide file tree
Showing 19 changed files with 298 additions and 60 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: release
run-name: Deploy to ${{ inputs.TARGET_ENVIRONMENT }} by @${{ github.actor }} from ${{ github.ref_name }}

on:
push:
branches:
- develop
workflow_dispatch:
inputs:
TARGET_ENVIRONMENT:
Expand All @@ -18,7 +15,7 @@ on:
- prod
APPS:
type: string
description: "The apps to release with this format: `app1=version1,app2=version2`. E. g.: `knapsack-gosdk=v1.2.0,knapsack-java-ortools=v1.2.0`"
description: "The apps to release with this format: `app-dir1=version1,app-dir2=version2`. E. g.: `knapsack-gosdk=v1.2.0,knapsack-java-ortools=v1.2.0`"
required: true

permissions:
Expand All @@ -37,6 +34,9 @@ jobs:
ROLE: ${{ secrets.AWS_DEVTOOLS_ROLE }}
REGION: ${{ secrets.AWS_REGION }}
GH_TOKEN: ${{ github.token }}
API_ENDPOINT: ${{ secrets.API_ENDPOINT }}
CONSOLE_URL: ${{ secrets.CONSOLE_URL }}
MARKETPLACE_API_KEY: ${{ secrets.MARKETPLACE_API_KEY }}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
permissions:
id-token: write
Expand All @@ -58,6 +58,10 @@ jobs:
git config --global user.signingkey ~/.ssh/signing.key
git clone git@github.com:nextmv-io/community-apps.git
cd community-apps
git fetch --all
git checkout ${{ github.ref_name }}
git pull
- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -70,15 +74,38 @@ jobs:
pip install -r requirements.txt
working-directory: ./community-apps/.nextmv

- name: Configure AWS credentials
- name: Set up AWS CLI
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.ROLE }}
aws-region: ${{ env.REGION }}
role-duration-seconds: 1200

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
cache: "maven"

- name: Install Nextmv CLI
run: |
export NEXTMV_API_KEY=$MARKETPLACE_API_KEY
export NEXTMV_BASE_URL=https://$API_ENDPOINT
curl -sS "https://$CONSOLE_URL/install-cli.txt" | bash -
- name: Set up Nextmv CLI
run: |
export PATH=$PATH:~/.nextmv # Make CLI available in non-interactive shell
nextmv configure \
--api-key $MARKETPLACE_API_KEY \
-e $API_ENDPOINT
nextmv activate
nextmv sdk install
- name: Upload apps and update manifest
run: |
export PATH=$PATH:~/.nextmv # Make CLI available in non-interactive shell
python update_apps.py \
--apps "${{ inputs.APPS }}" \
--bucket "${{ env.BUCKET }}" \
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,6 @@ go.work.sum

# VSCode stuff
.vscode/

# Java stuff
main.jar
51 changes: 51 additions & 0 deletions .nextmv/push_app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/env/bin bash
set -e

# Checks that APP_DIR is set.
if [[ -z "${APP_DIR}" ]]; then
>&2 echo "❌ APP_DIR must be set"
exit -1
fi

# Checks that APP_ID is set.
if [[ -z "${APP_ID}" ]]; then
>&2 echo "❌ APP_ID must be set"
exit -1
fi

# Checks that MARKETPLACE_APP_ID is set.
if [[ -z "${MARKETPLACE_APP_ID}" ]]; then
>&2 echo "❌ MARKETPLACE_APP_ID must be set"
exit -1
fi

# Checks that VERSION_ID is set.
if [[ -z "${VERSION_ID}" ]]; then
>&2 echo "❌ VERSION_ID must be set"
exit -1
fi

# Pushes app to Marketplace.
cd $APP_DIR
nextmv app push \
--app-id $APP_ID
nextmv app version create \
--app-id $APP_ID \
--version-id $VERSION_ID \
--name $VERSION_ID \
--description "Version ${VERSION_ID}"
nextmv app instance create \
--app-id $APP_ID \
--version-id $VERSION_ID \
--name $VERSION_ID \
--description "Instance ${VERSION_ID}" \
--instance-id $VERSION_ID
nextmv app update \
--app-id $APP_ID \
--instance-id $VERSION_ID
nextmv marketplace app version create \
--marketplace-app-id $MARKETPLACE_APP_ID \
--partner-id "nextmv" \
--reference-version-id $VERSION_ID \
--version-id $VERSION_ID \
--changelog "Version ${VERSION_ID}"
Loading

0 comments on commit 2c99dce

Please sign in to comment.