From e13198396727b596e66ac9b10a265060e17b879f Mon Sep 17 00:00:00 2001 From: JulioV Date: Mon, 7 Dec 2020 21:08:14 -0500 Subject: [PATCH] Add dev/tag triggered docs and git flow --- .github/workflows/docs.yaml | 12 ++++- docs/developers/git-flow.md | 105 ++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 3 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 docs/developers/git-flow.md diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 80d7fb43..a3a2460a 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -2,7 +2,9 @@ name: docs on: push: branches: - - day_segments + - develop + tags: + - "v[0-9]+.[0-9]+.[0-9]+" jobs: deploy: runs-on: ubuntu-latest @@ -18,6 +20,12 @@ jobs: - run: | git config user.name github-actions git config user.email github-actions@github.com - mike deploy --push --update-aliases 0.1 latest + - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - run: echo "DOCS_TAG=$(echo $RELEASE_VERSION | sed -n "s/v\([0-9]\+\.[0-9]\+\).*$/\1/p")" >> $GITHUB_ENV + - if: startsWith(github.ref, 'refs/tags') + run: mike deploy --push --update-aliases $DOCS_TAG latest + - if: ${{ github.ref == 'refs/heads/develop' }} + run: mike deploy --push --update-aliases dev + env: GH_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/docs/developers/git-flow.md b/docs/developers/git-flow.md new file mode 100644 index 00000000..0e1ef808 --- /dev/null +++ b/docs/developers/git-flow.md @@ -0,0 +1,105 @@ +# Git Flow + +We use the `develop/master` variation of the [OneFlow](https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow) git flow + +## Add New Features +We use feature (topic) branches to implement new features + +1. Pull the latest develop +```bash +git checkout develop +git pull +``` +1. Create your feature branch +```bash +git checkout -b feature/feature1 +``` +1. Add, modify or delete the necessary files to add your new feature +2. Stage and commit your changes using VS Code git GUI or the following commands +```bash +git add modified-file1 modified-file2 +git commit -m "Add my new feature" # use a concise description +``` +1. Integrate your new feature to `develop` + +=== "Internal Developer" + You are an internal developer if you have writing permissions to the repository. + + Most feature branches are never pushed to the repo, only do so if you expect that its development will take days (to avoid losing your work if you computer is damaged). Otherwise follow the following instructions to locally rebase your feature branch into `develop` and push those rebased changes online. + + ```bash + git checkout feature/feature1 + git rebase -i develop + git checkout develop + git merge --no-ff feature/feature1 # (use the default merge message) + git push origin develop + git branch -d feature/feature1 + ``` + +=== "External Developer" + You are an external developer if you do NOT have writing permissions to the repository. + + Push your feature branch online + ```bash + git push --set-upstream origin feature/external-test + ``` + Then open a pull request to the `develop` branch using Github's GUI + +## Release a New Version + +1. Pull the latest develop +```bash +git checkout develop +git pull +``` +1. Create a new release branch +```bash +git describe --abbrev=0 --tags # Bump the release (0.1.0 to 0.2.0 => NEW_HOTFIX) +git checkout -b release/v[NEW_RELEASE] develop +``` +1. Add new tag +```bash +git tag v[NEW_RELEASE] +``` +1. Merge and push the release branch +```bash +git checkout develop +git merge release/v[NEW_RELEASE] +git push --tags origin develop +git branch -d release/v[NEW_RELEASE] +``` +1. Fast-forward master +``` +git checkout master +git merge --ff-only develop +git push +``` +1. Go to [GitHub](https://github.com/carissalow/rapids/tags) and create a new release based on the newest tag `v[NEW_RELEASE]` (remember to add the change log) + +## Release a Hotfix +1. Pull the latest master +```bash +git checkout master +git pull +``` +1. Start a hotfix branch +```bash +git describe --abbrev=0 --tags # Bump the hotfix (0.1.0 to 0.1.1 => NEW_HOTFIX) +git checkout -b hotfix/v[NEW_HOTFIX] master +``` +1. Fix whatever needs to be fixed +1. Tag and merge the hotfix +```bash +git tag v[NEW_HOTFIX] +git checkout develop +git merge hotfix/v[NEW_HOTFIX] +git push --tags origin develop +git branch -d hotfix/v[NEW_HOTFIX] +``` +1. Fast-forward master +``` +git checkout master +git merge --ff-only v[NEW_HOTFIX] +git push +``` +1. Go to [GitHub](https://github.com/carissalow/rapids/tags) and create a new release based on the newest tag `v[NEW_HOTFIX]` (remember to add the change log) diff --git a/mkdocs.yml b/mkdocs.yml index 69feb7ef..a11cd595 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -105,6 +105,7 @@ nav: - Data Quality: visualizations/data-quality-visualizations.md - Features: visualizations/feature-visualizations.md - Developers: + - Git Flow: developers/git-flow.md - Remote Support: developers/remote-support.md - Virtual Environments: developers/virtual-environments.md - Documentation: developers/documentation.md