Bump app component from 2e019529 to a39102d7 #275
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: Deploy submodule updates to the staging environment | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
deploy-app: | |
description: Deloy the app to staging | |
type: boolean | |
default: true | |
deploy-tenant-manager: | |
description: Deploy the tenant manager to staging | |
type: boolean | |
default: true | |
jobs: | |
cloud_deployment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: false | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Set up files changed | |
id: files | |
run: | | |
echo "::set-output name=files-changed::$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})" | |
echo "::set-output name=app-commit::$(git ls-tree HEAD components/app | awk '{print $3}')" | |
echo "::set-output name=tenant-manager-commit::$(git ls-tree HEAD components/tenant-manager | awk '{print $3}')" | |
- name: Generate a token | |
id: generate_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ vars.TENZIR_AUTOBUMPER_APP_ID }} | |
private-key: ${{ secrets.TENZIR_AUTOBUMPER_APP_PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
- name: Deploy tenant-manager | |
if: | | |
(github.event_type == 'workflow_dispatch' && inputs.deploy-tenant-manager) || | |
(github.event_type == 'push' && contains(steps.files.outputs.files-changed, 'components/tenant-manager')) | |
env: | |
GH_TOKEN: ${{ steps.generate_token.outputs.token }} | |
run: | | |
# The workflow_dispatch only supports tags or branches as targets, | |
# not direct commit hashes, so we push a branch first. | |
git submodule set-url components/tenant-manager https://x-access-token:$GH_TOKEN@github.com/tenzir/event-horizon.git/ | |
git submodule update --init components/tenant-manager | |
git -C components/tenant-manager push -f origin ${{ steps.files.outputs.tenant-manager-commit }}:refs/heads/platform-staging | |
gh workflow -R tenzir/event-horizon run tzcp-deploy-staging.yaml \ | |
--ref platform-staging | |
- name: Deploy app | |
if: | | |
(github.event_type == 'workflow_dispatch' && inputs.deploy-app) || | |
(github.event_type == 'push' && contains(steps.files.outputs.files-changed, 'components/app')) | |
env: | |
GH_TOKEN: ${{ steps.generate_token.outputs.token }} | |
run: | | |
git submodule set-url components/app https://x-access-token:$GH_TOKEN@github.com/tenzir/app.git/ | |
git submodule update --init components/app | |
git -C components/app push -f origin ${{ steps.files.outputs.app-commit }}:refs/heads/platform-staging | |
gh workflow -R tenzir/app run deploy-to-vercel.yaml \ | |
--ref platform-staging \ | |
-f deploy-staging=true |