diff --git a/.github/workflows/CD_Backend.yml b/.github/workflows/CD_Backend.yml new file mode 100644 index 0000000..0025cf0 --- /dev/null +++ b/.github/workflows/CD_Backend.yml @@ -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/github-tag-action@v6.2 + 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 diff --git a/.github/workflows/CI_Backend.yml b/.github/workflows/CI_Backend.yml index b913388..fe0cdce 100644 --- a/.github/workflows/CI_Backend.yml +++ b/.github/workflows/CI_Backend.yml @@ -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: @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 6c32608..ccda1aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,4 +38,4 @@ services: - "8080:80" volumes: - pgdata: + pgdata: \ No newline at end of file