add migration script and mk target, integrate it to the workflow #177
Workflow file for this run
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: swis-api CI/CD pipeline | ||
on: | ||
workflow_dispatch: | ||
push: | ||
#branches: [ master ] | ||
tags: | ||
- 'v5.*' | ||
jobs: | ||
unit: | ||
runs-on: [ self-hosted, builder, docker ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run unit/integration tests. | ||
env: | ||
GIN_MODE: test | ||
HOSTNAME: ${{ vars.HOSTNAME }} | ||
run: make unit | ||
build: | ||
runs-on: [ self-hosted, builder, docker ] | ||
needs: [ unit ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build new swapi image (with staging). | ||
env: | ||
APP_URL: ${{ secrets.APP_URL }} | ||
ROOT_TOKEN: ${{ secrets.ROOT_TOKEN }} | ||
REGISTRY: ${{ secrets.REGISTRY }} | ||
run: make build | ||
push: | ||
runs-on: [ self-hosted, builder, docker ] | ||
needs: [ build ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Push the image to registry. | ||
env: | ||
REGISTRY: ${{ secrets.REGISTRY }} | ||
run: make push_to_registry | ||
test_deploy: | ||
runs-on: [ self-hosted, rabbit, docker ] | ||
needs: [ push ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run test container and run end-to-end test on it. | ||
env: | ||
LOKI_URL: ${{ secrets.LOKI_URL }} | ||
GIN_MODE: debug | ||
HOSTNAME: ${{ vars.HOSTNAME }} | ||
REGISTRY: ${{ secrets.REGISTRY }} | ||
run: make test_deploy e2e | ||
dump_and_migrate: | ||
runs-on: [ self-hosted, rabbit, docker ] | ||
needs: [ test_deploy ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Dump production data. | ||
env: | ||
APP_URL: ${{ secrets.APP_URL }} | ||
ROOT_TOKEN: ${{ secrets.ROOT_TOKEN }} | ||
run: make dump migrations | ||
prod_deploy: | ||
runs-on: [ self-hosted, rabbit, docker ] | ||
needs: [ dump_data ] | ||
Check failure on line 70 in .github/workflows/deployment.yml GitHub Actions / swis-api CI/CD pipelineInvalid workflow file
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Deploy prod docker container, recreate container with fresh image. | ||
env: | ||
APP_ENVIRONMENT: production | ||
APP_URL: ${{ secrets.APP_URL }} | ||
LOKI_URL: ${{ secrets.LOKI_URL }} | ||
ROOT_TOKEN: ${{ secrets.ROOT_TOKEN }} | ||
GIN_MODE: ${{ secrets.GIN_MODE }} | ||
CF_BEARER_TOKEN: ${{ secrets.CF_BEARER_TOKEN }} | ||
CF_API_EMAIL: ${{ secrets.CF_API_EMAIL }} | ||
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | ||
REGISTRY: ${{ secrets.REGISTRY }} | ||
run: make run | ||
import_data: | ||
runs-on: [ self-hosted, rabbit, docker ] | ||
needs: [ prod_deploy ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Import dumped data to production. | ||
env: | ||
APP_URL: ${{ secrets.APP_URL }} | ||
ROOT_TOKEN: ${{ secrets.ROOT_TOKEN }} | ||
run: make import_dump | ||
generate_docs: | ||
runs-on: [ self-hosted, rabbit, docker ] | ||
needs: [ import_data ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: (re)Generate interface API swagger docs. | ||
env: | ||
APP_URL: ${{ secrets.APP_URL }} | ||
run: make docs | ||