Skip to content

Commit

Permalink
Update CI (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
Utwo authored Nov 8, 2021
1 parent d91aaa5 commit f90f122
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 102 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/build-prod.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/build-stage.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
push:
tags:
- "v*"

name: Deploy

env:
DOCKER_IMAGE_BASE: code4romania/rezultate-vot-api

jobs:
build-dockerimage:
name: Build Docker container
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set tag env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./src
file: src/ElectionResults.API/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ env.DOCKER_IMAGE_BASE }}:latest,${{ env.DOCKER_IMAGE_BASE }}:${{ env.RELEASE_VERSION }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
56 changes: 56 additions & 0 deletions .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
on:
push:
branches:
- develop

name: Build & Deploy API Staging

env:
IMAGE_NAME: code4romania/rezultate-vot-api

jobs:
build-parser:
name: Build API container
runs-on: ubuntu-latest

steps:
- name: Checkoout
uses: actions/checkout@v2

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./src
file: src/ElectionResults.API/Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: ${{ env.DOCKER_IMAGE_BASE }}:${{ env.GITHUB_SHA }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Update and restart API
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.STAGING_SERVER_IP }}
username: ${{ secrets.STAGING_SERVER_SSH_USERNAME }}
key: ${{ secrets.STAGING_SERVER_SSH_KEY }}
script: "/home/ubuntu/restart.sh"
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Rezultate Vot API

[![Docker tag](https://img.shields.io/docker/v/code4romania/rezultate-vot-api?style=for-the-badge)](https://hub.docker.com/r/code4romania/rezultate-vot-api/tags)
[![GitHub contributors](https://img.shields.io/github/contributors/code4romania/rezultate-vot-api.svg?style=for-the-badge)](https://github.com/code4romania/rezultate-vot-api/graphs/contributors) [![GitHub last commit](https://img.shields.io/github/last-commit/code4romania/rezultate-vot-api.svg?style=for-the-badge)](https://github.com/code4romania/rezultate-vot-api/commits/master) [![License: MPL 2.0](https://img.shields.io/badge/license-MPL%202.0-brightgreen.svg?style=for-the-badge)](https://opensource.org/licenses/MPL-2.0)

O democrație se sprijină pe cetățeni critici și informați. Rezultate Vot își propune să informeze și să dezvolte spiritul critic al alegătorilor prin contextualizarea informației electorale însoțite de analize apartinice ale acesteia. Această platformă este locul în care oricine poate accesa toate informațiile relevante ale alegerilor din România.

[See the project live](https://rezultatevot.ro/)
[See the project live](https://rezultatevot.ro)

Pe Rezultate Vot veți găsi:

- Hărți detaliate pe care puteți vizualiza prezența la vot la nivelul țării / la nivel de județ;
- Rezultatele parțiale ale alegerilor, după închiderea urnelor, pe măsură ce ele sunt comunicate de autorități;
- Informații din sistemul de monitorizare digitală a alegerilor - Monitorizare Vot - realizat de Code for Romania și utilizat de observatorii alegerilor
Expand All @@ -19,32 +21,37 @@ Pe Rezultate Vot veți găsi:

This project is built by amazing volunteers and you can be one of them! Here's a list of ways in [which you can contribute to this project](https://github.com/code4romania/.github/blob/master/CONTRIBUTING.md). If you want to make any change to this repository, please **make a fork first**.

If you would like to suggest new functionality, open an Issue and mark it as a __[Feature request]__. Please be specific about why you think this functionality will be of use. If you can, please include some visual description of what you would like the UI to look like, if you are suggesting new UI elements.
If you would like to suggest new functionality, open an Issue and mark it as a **[Feature request]**. Please be specific about why you think this functionality will be of use. If you can, please include some visual description of what you would like the UI to look like, if you are suggesting new UI elements.

## Built With

.net core 3.1

### Programming languages

C# 8

## Repos and projects

Client App - https://github.com/code4romania/rezultate-vot-client

## Deployment

Guide users through getting your code up and running on their own system. In this section you can talk about:
1. Installation process
2. Software dependencies
3. Latest releases
4. API references
### Stage

Every push to develop branch should trigger a new deploy on stage server

### Production

Describe and show how to build your code and run the tests.
1. Add a new tag to the repository
2. Go to the [Code4ro k8s manifest repo](https://github.com/code4romania/code4ro-k8s) and update the k8s manifest with the new image tag

## Feedback

* Request a new feature on GitHub.
* Vote for popular feature requests.
* File a bug in GitHub Issues.
* Email us with other feedback [email protected]
- Request a new feature on GitHub.
- Vote for popular feature requests.
- File a bug in GitHub Issues.
- Email us with other feedback [email protected]

## License

Expand Down

0 comments on commit f90f122

Please sign in to comment.