Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflows #9

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
APP_PORT=3004
APP_ENV=development
APP_SERVICE_NAME=rpkm67-checkin

DB_URL=postgres://root:1234@localhost:5432/rpkm67_db

TRACER_ENDPOINT=localhost:4318
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
- [ ]  New features
- [ ]  Bug fixes
- [ ]  Breaking changes
- [ ] Refactor
## Describe what you have done
-
### New Features
-
### Fix
-
### Others
-
-
61 changes: 55 additions & 6 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,47 @@ name: Build

on:
workflow_dispatch:
push:
pull_request:
types:
- closed
branches:
- main
- dev
tags:
- v*

env:
SERVICE_NAME: rpkm67-checkin
IMAGE_NAME: ghcr.io/${{ github.repository }}
IMAGE_TAG: ${{ github.sha }}
IMAGE_TAG: <WILL_BE_SET>

jobs:
build:
name: Build
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
outputs:
IMAGE_TAG: ${{ steps.tag_action.outputs.new_tag }}

permissions:
contents: read
contents: write
packages: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'

- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.64.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
RELEASE_BRANCHES: dev
DEFAULT_BUMP: patch
id: tag_action

- name: Set IMAGE_TAG
run: echo "IMAGE_TAG=${{ steps.tag_action.outputs.new_tag }}" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand All @@ -40,5 +60,34 @@ jobs:
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }},${{ env.IMAGE_NAME }}:latest
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max

cd:
name: Continuous Deployment
needs: build
runs-on: ubuntu-latest
env:
IMAGE_TAG: ${{ needs.build.outputs.IMAGE_TAG }}

# docker pull --platform linux/x86_64
steps:
- name: Checkout DevOps repository
uses: actions/checkout@v4
with:
repository: isd-sgcu/rpkm67-devops
token: ${{ secrets.RPKM67_DEVOPS_TOKEN }}

- name: Update image tag in dev
uses: mikefarah/yq@master
with:
cmd: yq -i '.[0].value = "${{ env.IMAGE_NAME }}:" + strenv(IMAGE_TAG)' isd/${{ env.SERVICE_NAME }}/deployment.yaml

- name: Update image tag in prod
uses: mikefarah/yq@master
if: github.ref == 'refs/heads/main'
with:
cmd: yq -i '.[0].value = "${{ env.IMAGE_NAME }}:" + strenv(IMAGE_TAG)' prod/${{ env.SERVICE_NAME }}/deployment.yaml

- name: Commit & Push changes
uses: actions-js/push@v1.4
with:
repository: isd-sgcu/rpkm67-devops
github_token: ${{ secrets.RPKM67_DEVOPS_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: Lint

on:
workflow_dispatch:
pull_request:
branches:
- main
- dev
push:
branches:
- main
- dev
tags:
- v*
pull_request:

permissions:
contents: read
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: 'Pull request/Push: Run unit test'
name: Unit Tests

on:
workflow_dispatch:
pull_request:
branches:
- dev
- master
- main
- beta
- dev
push:
branches:
- dev
- master
- main
- beta
- dev
tags:
- v*

jobs:
build:
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ docker:
docker rm -v -f $$(docker ps -qa) || echo "No containers found. Skipping removal."
docker-compose up

docker-qa:
docker rm -v -f $$(docker ps -qa) || echo "No containers found. Skipping removal."
docker-compose -f docker-compose.qa.yml up

server:
go run cmd/main.go

Expand Down
176 changes: 0 additions & 176 deletions docker-compose.qa.template.yml

This file was deleted.

Loading