-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ivan Milchev <[email protected]>
- Loading branch information
Showing
5 changed files
with
180 additions
and
69 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
branches: [master] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
build-api-docker-image: | ||
name: Build API docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Login to GitHub Packages Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: devops-podkrepi-bg | ||
password: ${{ secrets.DEVOPS_PACKAGES_TOKEN }} | ||
|
||
- name: Get tag | ||
id: vars | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
run: echo ::set-output name=version::${GITHUB_REF#refs/*/} | ||
|
||
- name: Get sha | ||
id: vars | ||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | ||
run: echo ::set-output name=version::${GITHUB_SHA} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
env: | ||
NODE_ENV: production | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
with: | ||
push: true | ||
target: production | ||
build-args: | | ||
APP_VERSION=${{ steps.vars.outputs.tag }} | ||
tags: ghcr.io/podkrepi-bg/api:${{ steps.vars.outputs.version }} | ||
|
||
build-migrations-docker-image: | ||
name: Build migrations docker image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Login to GitHub Packages Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: devops-podkrepi-bg | ||
password: ${{ secrets.DEVOPS_PACKAGES_TOKEN }} | ||
|
||
- name: Get tag | ||
id: vars | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
run: echo ::set-output name=version::${GITHUB_REF#refs/*/} | ||
|
||
- name: Get sha | ||
id: vars | ||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | ||
run: echo ::set-output name=version::${GITHUB_SHA} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
env: | ||
NODE_ENV: production | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
with: | ||
push: true | ||
file: Dockerfile.migrations | ||
build-args: | | ||
APP_VERSION=${{ steps.vars.outputs.version }} | ||
tags: ghcr.io/podkrepi-bg/api/migrations:${{ steps.vars.outputs.version }} | ||
|
||
release-dev: | ||
name: Release to dev | ||
runs-on: ubuntu-latest | ||
needs: [build-api-docker-image, build-migrations-docker-image] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install kubectl | ||
uses: azure/setup-kubectl@v3 | ||
|
||
- name: Install kustomize | ||
uses: imranismail/setup-kustomize@v1 | ||
|
||
- name: Get tag | ||
id: vars | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
run: echo ::set-output name=version::${GITHUB_REF#refs/*/} | ||
|
||
- name: Get sha | ||
id: vars | ||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | ||
run: echo ::set-output name=version::${GITHUB_SHA} | ||
|
||
- name: Set container versions in manifests | ||
working-directory: manifests/overlays/automation | ||
run: | | ||
kustomize edit set image api-headless=ghcr.io/podkrepi-bg/api:v0.6.0 | ||
kustomize edit set image migrate-database=ghcr.io/podkrepi-bg/api/migrations:v0.6.0 | ||
- name: Set kubeconfig | ||
run: echo ${{ secrets.K8S_DEV_CONFIG }} > config.yaml | ||
|
||
- name: Apply new manifests | ||
run: kubectl apply -f manifests/overlays/automation | ||
|
||
- name: Delete kubeconfig | ||
if: always() | ||
run: rm config.yaml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: api-headless | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: api-headless | ||
template: | ||
spec: | ||
initContainers: | ||
- name: migrate-database | ||
imagePullPolicy: Always | ||
containers: | ||
- name: api-headless | ||
imagePullPolicy: Always | ||
env: | ||
- name: APP_ENV | ||
value: staging | ||
- name: S3_ENDPOINT | ||
valueFrom: | ||
secretKeyRef: | ||
name: rook-ceph-object-user-object-store-dev-object-store-dev-admin | ||
key: Endpoint | ||
- name: S3_ACCESS_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: rook-ceph-object-user-object-store-dev-object-store-dev-admin | ||
key: AccessKey | ||
- name: S3_SECRET_ACCESS_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: rook-ceph-object-user-object-store-dev-object-store-dev-admin | ||
key: SecretKey |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: keycloak-config | ||
data: | ||
url: https://keycloak-dev.podkrepi.bg | ||
realm: webapp-dev |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: podkrepibg-dev | ||
|
||
|
||
patches: | ||
- path: keycloak-config.patch.yaml | ||
- path: deployment.patch.yaml | ||
|
||
images: | ||
- name: ghcr.io/podkrepi-bg/api | ||
newTag: master | ||
- name: ghcr.io/podkrepi-bg/api/migrations | ||
newTag: master | ||
resources: | ||
- ../../base |
a42a094
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
169 tests passing in 62 suites.
Report generated by 🧪jest coverage report action from a42a094