Fix the wrong hash #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Webapp Deployment Workflow | |
on: | |
push: | |
branches: | |
- "master" | |
- "main" | |
- "webapp" | |
- "jun-test-cross-workflow" | |
pull_request: | |
branches: | |
- "master" | |
- "main" | |
- "webapp" | |
- "jun-test-cross-workflow" | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Get short Git commit hash | |
id: version | |
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Checkout webapp branch | |
uses: actions/checkout@v4 | |
with: | |
ref: webapp | |
path: webapp | |
fetch-depth: 1 | |
- name: Set up Git LFS | |
run: | | |
git lfs install | |
git lfs pull | |
- name: Remove binary files from git history | |
run: | | |
pip install git-filter-repo | |
git filter-repo --path DiverseSelector/test/test2/BBB_SECFP6_1024.xlsx --path DiverseSelector/test/test2/BBB_SECFP6_2048.xlsx --invert-paths --force | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Prepare build context | |
run: | | |
cp webapp/Dockerfile . | |
cp -r webapp/streamlit_app . | |
cp webapp/README_hf.md . | |
- name: Build Docker image | |
run: | | |
docker build . -t qcdevs/selector:${{ env.VERSION }} | |
- name: Push Docker image | |
env: | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
run: | | |
docker login -u qcdevs -p $DOCKERHUB_TOKEN | |
docker push qcdevs/selector:${{ env.VERSION }} | |
- name: Replace README for Hugging Face | |
run: | | |
mv README_hf.md README.md | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "qcdevs@gmail.com" | |
git add README.md | |
git commit -m "Replace README.md with README_hf.md for Hugging Face" | |
- name: Push to Hugging Face | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
run: | | |
git push https://QCDevs:$HF_TOKEN@huggingface.co/spaces/QCDevs/selector HEAD:main --force |