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

Feature/ci #27

Merged
merged 19 commits into from
Mar 11, 2022
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
4 changes: 3 additions & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'bug'
autolabeler:
- label: 'bug'
branch:
- '/fix\/.+'
- '/hotfix\/.+'
- '/bug\/.+'
- label: 'feature'
branch:
- '/feature\/.+/'
- '/feat\/.+/'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
template: |
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/publish-image-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Push Docker image to GitHub container
on:
push:
tags:
- 'v*'
pull_request:
types: [opened, reopened, synchronize]
jobs:
release_github:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Publish release
uses: release-drafter/release-drafter@v5
with:
name: ${{ steps.get_version.outputs.VERSION }}
tag: ${{ steps.get_version.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build_and_push:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Build the Docker image
run: TAG=action docker-compose -f docker-compose-prod.yml build
- name: Login to GHCR
if: success()
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Push on GHCR
run: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add multiple command in a bash script like : bash ci/docker-tag.sh

docker tag basegun-front:action-prod ghcr.io/datalab-mi/basegun/basegun-frontend:${{ steps.get_version.outputs.VERSION }}
docker tag basegun-back:action-prod ghcr.io/datalab-mi/basegun/basegun-backend:${{ steps.get_version.outputs.VERSION }}
docker push ghcr.io/datalab-mi/basegun/basegun-frontend:${{ steps.get_version.outputs.VERSION }}
docker push ghcr.io/datalab-mi/basegun/basegun-backend:${{ steps.get_version.outputs.VERSION }}
docker tag ghcr.io/datalab-mi/basegun/basegun-frontend:${{ steps.get_version.outputs.VERSION }} ghcr.io/datalab-mi/basegun/basegun-frontend:latest
docker tag ghcr.io/datalab-mi/basegun/basegun-backend:${{ steps.get_version.outputs.VERSION }} ghcr.io/datalab-mi/basegun/basegun-backend:latest
docker push ghcr.io/datalab-mi/basegun/basegun-frontend:latest
docker push ghcr.io/datalab-mi/basegun/basegun-backend:latest
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ env/
.env
__pycache__
*.weights
temp/
temp/
openrc.sh
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ up-%: check-dc-config-%

down-%:
${DC} -f docker-compose-$*.yml down

show-current-tag:
@while [ -z "$$CONTINUE" ]; do \
read -r -p "Current tag is v${TAG}. Continue? [y/N]: " CONTINUE; \
done ; \
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)

tag: show-current-tag
git tag -a v${TAG}
git push origin v${TAG}

untag: show-current-tag
git tag -d v${TAG}
git push --delete v${TAG}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ make down-dev
# stop in prod
make down-prod
```

# Release an official version of code
1. Update tag in Makefile
2. `make tag`
This will create a draft release in github (to validate) and some docker image packages with this tag.