diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..60e3b3a --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,49 @@ +name: Go + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + TARGET_DIR: /home/${{secrets.SSH_USERNAME}}/apps/event-mgmt-core + DB_DSN: "postgres://${{secrets.DATABASE_USER}}:${{secrets.DATABASE_PASSWORD}}@${{secrets.DATABASE_HOST}}:${{secrets.DATABASE_PORT}}/${{secrets.DATABASE_NAME}}?sslmode=${{secrets.DATABASE_SSL_MODE}}" + +jobs: + + build: + runs-on: ubuntu-latest + steps: + # Checkout makes source available for remote deploy. + - uses: actions/checkout@v4 + + # Setup Golang for build and testing. + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.22.3' + + # Run tests + - name: Test + run: go test -v ./... + + # Deploys all the source (currently). + # Might be better to deploy only the compiled binary and do additional setup. + - name: Remote deploy + uses: cross-the-world/ssh-scp-ssh-pipelines@v1.1.4 + with: + host: ${{secrets.SSH_HOST}} + key: ${{secrets.SSH_KEY}} + user: ${{secrets.SSH_USERNAME}} + first_ssh: | + rm -rf $TARGET_DIR + mkdir -p $TARGET_DIR + scp: |- + "." => $TARGET_DIR + last_ssh: |- + cd $TARGET_DIR + /usr/local/go/bin/go build -o bin/emc main.go + /usr/local/bin/migrate -path=./migrations -database=$DB_DSN up + systemctl --user restart event-mgmt-core + \ No newline at end of file diff --git a/README.md b/README.md index 94f17e1..94f2db9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Event Management System +# Event Management System +[![Go](https://github.com/BEOpenSourceCollabs/EventManagementCore/actions/workflows/go.yml/badge.svg)](https://github.com/BEOpenSourceCollabs/EventManagementCore/actions/workflows/go.yml) User management - login / sign up / roles assigned to users ( organisers, admins and normal users) diff --git a/static/swagger.json b/static/swagger.json index a11d160..fafc45a 100644 --- a/static/swagger.json +++ b/static/swagger.json @@ -11,6 +11,15 @@ "servers": [ { "url": "http://localhost:8081/api" + }, + { + "url": "https://api.event-local.online/api" + }, + { + "url": "https://dev-api.event-local.online/api" + }, + { + "url": "https://qa-api.event-local.online/api" } ], "tags": [ diff --git a/static/swagger/swagger-initializer.js b/static/swagger/swagger-initializer.js index 605f1fd..912be35 100644 --- a/static/swagger/swagger-initializer.js +++ b/static/swagger/swagger-initializer.js @@ -3,7 +3,7 @@ window.onload = function() { // the following lines will be replaced by docker/configurator, when it runs in a docker-container window.ui = SwaggerUIBundle({ - url: "http://localhost:8081/swagger.json", + url: "/swagger.json", dom_id: '#swagger-ui', deepLinking: true, presets: [