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

Implement CD actions #115

Merged
merged 2 commits into from
Apr 28, 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
38 changes: 35 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
name: Continuous Deployment

on:
push:
tags:
- 'v*'
pull_request:
types: [closed]
branches: ['master', 'v2/master']

env:
IMAGE_NAME: tafseer_api

jobs:
release:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get version
id: get_version
run: |
echo ::set-output name=VERSION::$(cat git-version)

- name: Bump version and create tag
id: bump_version
uses: mathieudutour/github-tag-action@v5.6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
release_branches: master
custom_tag: ${{ steps.get_version.outputs.VERSION }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.new_tag }}
release_name: Release ${{ steps.bump_version.outputs.new_tag }}
draft: false
prerelease: false

push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,3 @@ jobs:

- name: Test
uses: robherley/go-test-action@v0

new-version:
runs-on: ubuntu-latest
# if: github.event.pull_request.merged
steps:
- name: Tag
id: tag
uses: K-Phoen/semver-release-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_format: 'v${{ steps.version.outputs.version }}'
release_branch: 'v2/master'
- name: Echo new tag
run: |
echo "New tag is ${{ steps.tag.outputs.tag }}"
Loading