Skip to content

Create github action to merge dev into main (#34) #100

Create github action to merge dev into main (#34)

Create github action to merge dev into main (#34) #100

name: Trigger CircleCI Build
on:
push:
branches:
- main
- dev
jobs:
trigger-circleci:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Determine environment and branch
id: env-branch
run: |
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
echo "::set-output name=environment::development"
echo "::set-output name=branch::dev"
else
echo "::set-output name=environment::production"
echo "::set-output name=branch::main"
fi
- name: Ensure repository is dashboard-runner
run: |
REPO_NAME=$(basename -s .git `git config --get remote.origin.url`)
if [ "$REPO_NAME" != "dashboard-runner" ]; then
echo "This action is only allowed to run in the earthfast/dashboard-runner repository."
exit 0
fi
- name: Trigger CircleCI Pipeline
run: |
curl -X POST \
-H "Circle-Token: ${{ secrets.CIRCLECI_API_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"branch": "${{ steps.env-branch.outputs.branch }}",
"parameters": {
"SOURCE_TYPE": "github",
"S3_URL": "",
"REPOSITORY": "https://github.com/cheran-senthil/cheran-senthil.github.io",
"BUILD_DIR": ".",
"PACKAGE_INSTALL_COMMAND": "ls",
"BUILD_COMMAND": "ls",
"OUTPUT_DIR": ".",
"ENVIRONMENT_VARIABLES": "",
"ONE_CLICK_SERVER_URL": "https://jorge.ngrok.pro",
"ENVIRONMENT": "${{ steps.env-branch.outputs.environment }}",
"CI_TRIGGER": true,
"PROJECT_ID": "1"
}
}' \
https://circleci.com/api/v2/project/gh/earthfast/dashboard-runner/pipeline
env:
CIRCLECI_API_TOKEN: ${{ secrets.CIRCLECI_API_TOKEN }}