Skip to content

Commit

Permalink
ci: remove dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
borolepratik committed May 19, 2024
1 parent 42b4bc7 commit bc10754
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Test, Build, Publish, Release

on:
push:
branches: [main, dev]
branches: [main]
pull_request:
branches: [main, dev]
branches: [main]

jobs:
test:
Expand Down Expand Up @@ -55,10 +55,10 @@ jobs:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# if branch is main, use prod else dev
BUILD_NAME: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }}
# if the event is push and (the branch is dev or the commit message starts with `bump:`), then upload the image
UPLOAD_IMAGE: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/dev' || startsWith(github.event.head_commit.message , 'bump:')) }}
# if branch is main, use prod
BUILD_NAME: ${{ github.ref == 'refs/heads/main' && 'prod' }}
# if the event is push and the commit message starts with `bump:`, upload the image
UPLOAD_IMAGE: ${{ github.event_name == 'push' && startsWith(github.event.head_commit.message , 'bump:') }}
needs: test
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
echo $GITHUB_ENV
# Log into a Docker registry
# The login is performed only if the event is push and (the branch is dev or the commit message starts with `bump:`)
# The login is performed only if the event is push and the commit message starts with `bump:`
- name: Login into registry ${{ env.REGISTRY }}
if: ${{ env.UPLOAD_IMAGE != 'false' }}
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
Expand All @@ -109,7 +109,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# Metadata is extracted only if the event is push and (the branch is dev or the commit message starts with `bump:`)
# Metadata is extracted only if the event is push and the commit message starts with `bump:`
- name: Extract Docker metadata
if: ${{ env.UPLOAD_IMAGE != 'false' }}
id: meta
Expand All @@ -126,7 +126,7 @@ jobs:
org.opencontainers.image.version=${{ env.VERSION }}
# Build and upload Docker image to GHCR with Buildx
# The image is uploaded only if the event is push and (the branch is dev or the commit message starts with `bump:`)
# The image is uploaded only if the event is push and the commit message starts with `bump:`
- name: Build and push
id: docker_build
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
Expand Down
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ For other docker commands, see [useful_commands.md](./useful_commands.md).

### Contribution Guidelines

- <u> ***NEVER MERGE YOUR OWN CODE; ALWAYS RAISE A PR AGAINST `dev`!*** </u>
- <u> ***NEVER MERGE YOUR OWN CODE; ALWAYS RAISE A PR AGAINST `main`!*** </u>
- Follow [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/) when authoring commit messages.
- **Always pull latest changes**
- There are several developers working on this project. Always pull/pull-rebase the latest, as necessary, from the branch you intend to commit your changes to.
Expand All @@ -151,18 +151,15 @@ For other docker commands, see [useful_commands.md](./useful_commands.md).
- [GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens) (freemium)
- [Git Graph](https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph) (free)
- **Branches**:
- `main` is the production mainline.
- `dev` is the development line (***default branch***).
- `main` is the production mainline (***default branch***).
- **PR merge strategy on Github**
- Code should flow in the following direction through branches:
```
feature/bug fix -> dev -> main
feature/bug fix -> main
```
- We'll be keeping a linear commit history and so using a combination of `Rebase and merge` and `Squash and merge` merge strategies.
- Use `Rebase and merge` as ***default*** to ensure all commits from the branch to be merged are brought in individually to the target branch.
- `Squash and merge` may be used ***ONLY*** when bringing in changes from a feature/bug fix branch into `dev`.
- To maintain linear commit history, ensure to use `push force` when:
- Bringing `dev` on the same commit as `main` (ie rebasing `dev` onto `main`).
- `Squash and merge` may be used ***ONLY*** when bringing in changes from a feature/bug fix branch into `main`.
- [More information on git rebase](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase).
- [More information on PR merge strategies](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/about-merge-methods-on-github).
- **Jira issue linking**
Expand Down

0 comments on commit bc10754

Please sign in to comment.