Skip to content

Commit

Permalink
Merge pull request #6 from Star-Academy/cicd
Browse files Browse the repository at this point in the history
feat: now cicd can work
  • Loading branch information
msm1984 authored Aug 16, 2024
2 parents 8339048 + dfa2d4e commit 5613602
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 42 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/CD_Backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CD_Backend

permissions:
contents: write

on:
push:
branches:
- dev

jobs:
version-and-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: login to docker registry
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}

- name: build and push docker image to registry
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: mohammadsadeghmontazeri/starback:latest

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: |
steps.tag_version.outputs.changelog
draft: false
prerelease: false
43 changes: 2 additions & 41 deletions .github/workflows/CI_Backend.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
name: CI_Backend

permissions:
contents: write
packages: write
issues: write
pull-requests: write
deployments: write

on:
pull_request:
branches:
- main
push:
branches:
- main
- dev

jobs:
build:
build-and-test:
runs-on: ubuntu-latest

steps:
Expand All @@ -36,32 +26,3 @@ jobs:

- name: Run tests
run: dotnet test --no-build --verbosity normal

semantic-versioning:
runs-on: ubuntu-latest
needs: build # Ensure this job runs after the build job

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the full history to calculate the next version

- name: Get next version
id: get_next_version
uses: thenativeweb/get-next-version@main
with:
prefix: "v"

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_next_version.outputs.version }}
release_name: Release ${{ steps.get_next_version.outputs.version }}
body: |
content change
draft: false
prerelease: false
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ services:
- "8080:80"

volumes:
pgdata:
pgdata:

0 comments on commit 5613602

Please sign in to comment.