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

Enforcing gitflow #37

Merged
merged 5 commits into from
Oct 3, 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
7 changes: 2 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ on:
branches:
- main
- develop
- cicd/add-auto-deployment

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -32,8 +31,6 @@ jobs:
echo "env_name=production" >> $GITHUB_OUTPUT
elif [ "${{ github.ref }}" = "refs/heads/develop" ]; then
echo "env_name=staging" >> $GITHUB_OUTPUT
elif [ "${{ github.ref }}" = "refs/heads/cicd/add-auto-deployment" ]; then
echo "env_name=staging" >> $GITHUB_OUTPUT
fi
- name: Print the environment
run: echo "The environment is ${{ steps.define_environment.outputs.env_name }}"
Expand Down Expand Up @@ -77,8 +74,7 @@ jobs:
GOOGLE_TAG_PREVIEW: ${{secrets.GOOGLE_TAG_PREVIEW}}
run: |
npm install
npm run build # vars.SUBPATH should include the preceeding slash /

npm run build
deploy:
runs-on: ubuntu-latest
needs: [build, define-environment]
Expand Down Expand Up @@ -117,6 +113,7 @@ jobs:

- name: Deploy to S3 Production
run: |
# vars.SUBPATH should include the preceeding slash /
aws s3 sync ./dist s3://${{ secrets.S3_BUCKET }}${{ vars.SUBPATH }} --cache-control max-age=30,must-revalidate,s-maxage=604800 --delete

- name: Request Invalidation to AWS Cloudfront
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/gitflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Gitflow Enforcer

on:
pull_request:
types: [opened, reopened, edited, synchronize]

jobs:
gitflow_enforcer:
runs-on: ubuntu-latest
steps:
- name: Check branch
if: github.base_ref == 'main' && github.head_ref != 'develop'
run: |
echo "ERROR: You can only merge to main from develop"
exit 1
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ Test in dev mode
npm run dev
```

## Git Workflow

This project follows a Gitflow branching model:

- Feature/Bugfix Branches: Start development from a feature or bugfix branch. Use a meaningful branch name like feature/your-feature or bugfix/your-bugfix.

- Pull Request to Development Branch: When your work is ready, open a pull request (PR) from your feature or bugfix branch to the development branch.

- Staging Deployment: Once the PR is merged into the development branch, the changes will automatically be deployed to the staging environment for further testing.

- Production Deployment: If the changes in staging are approved, open a PR from the development branch to the main branch. Upon merging, the changes will be deployed to the production environment.

## Branch Protection Rules
- Development Branch: The development branch is protected, and direct commits are not allowed. All changes must come through pull requests.

- Main Branch: The main branch is also protected and only accepts pull requests from the development branch.

## Configuration

The ```config.json``` file is a vital metadata file that points the application to the proper video and image service endpoints. For the application to run properly, it’s important to configure the file according to the following parameters.
Expand Down
Loading