Skip to content

Commit

Permalink
Implement CD actions (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmadMokhtar committed Apr 28, 2024
1 parent 7a32e81 commit a033e86
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
38 changes: 35 additions & 3 deletions .github/workflows/cd.yml
@@ -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
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 }}"

0 comments on commit a033e86

Please sign in to comment.