Skip to content

ci: Revert allow any ip and port 5761 #91

ci: Revert allow any ip and port 5761

ci: Revert allow any ip and port 5761 #91

name: Trigger Tracecat deployment
on:
push:
branches: main
tags:
- "v*"
workflow_dispatch:
inputs:
build-env:
type: choice
description: Build environment
required: true
options:
- production
- staging
ref:
description: "Branch, commit sha, or tag to deploy"
required: true
jobs:
trigger-deployment:
runs-on: ubuntu-latest
steps:
- name: Set Environment
id: set-env
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "BUILD_ENV=${{ github.event.inputs.build-env }}" >> $GITHUB_ENV
echo "DEPLOY_REF=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
else
echo "BUILD_ENV=$( [[ '${{ github.ref }}' == 'refs/heads/main' ]] && echo 'staging' || echo 'production' )" >> $GITHUB_ENV
echo "DEPLOY_REF=${{ github.sha }}" >> $GITHUB_ENV
fi
- name: Trigger
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const environment = process.env.BUILD_ENV;
const ref = process.env.DEPLOY_REF;
// Send a repository_dispatch event to trigger the Deploy to AWS workflow
github.rest.repos.createDispatchEvent({
owner: 'TracecatHQ',
repo: 'tracecat-deployment',
event_type: 'deploy',
client_payload: {
'build-env': environment,
'ref': ref
}
});