Skip to content

ci: strip dash if master #150

ci: strip dash if master

ci: strip dash if master #150

Workflow file for this run

name: Deploy instance
on:
pull_request:
types: [opened, reopened, labeled, synchronize]
# Cancel previous runs of the same workflow and PR number or branch/tag
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
deploy-instance:
if: contains(github.event.pull_request.labels.*.name, 'deploy')
runs-on: ubuntu-latest
env:
INSTANCE_HOST: 'https://dev.im.dhis2.org'
INSTANCE_NAME: pr-${{ github.event.pull_request.number }}
steps:
- name: Wait for API tests
uses: lewagon/[email protected]
with:
ref: ${{ github.head_ref }}
check-name: 'api-test'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
repository: dhis2-sre/im-manager
sparse-checkout: scripts/instances
- name: Install HTTPie
run: python -m pip install httpie
- name: Deploy DHIS2 instance
working-directory: scripts/instances
env:
HTTP: https --check-status
USER_EMAIL: ${{ secrets.IM_BOT_EMAIL }}
PASSWORD: ${{ secrets.IM_BOT_PASSWORD }}
IM_HOST: 'https://api.im.dhis2.org'
IMAGE_REPOSITORY: core-pr
IMAGE_TAG: ${{ github.event.pull_request.number }}
IMAGE_PULL_POLICY: Always
DATABASE_ID: sl-sierra-leone-dev-sql-gz
run: ./findByName.sh dev $INSTANCE_NAME && ./restart.sh dev $INSTANCE_NAME || ./deploy-dhis2.sh dev $INSTANCE_NAME
- name: Wait for instance
run: timeout 300 bash -c 'while [[ "$(curl -fsSL -o /dev/null -w %{http_code} $INSTANCE_HOST/$INSTANCE_NAME)" != "200" ]]; do sleep 5; done'
- name: Generate analytics
run: curl -X POST -u "${{ secrets.DHIS2_USERNAME }}:${{ secrets.DHIS2_PASSWORD }}" "$INSTANCE_HOST/$INSTANCE_NAME/api/resourceTables/analytics" -d 'executeTei=true'
- name: Comment instance URL
uses: actions-cool/maintain-one-comment@v3
with:
body: "Instance deployed to https://dev.im.dhis2.org/pr-${{ github.event.pull_request.number }}"