Update the workflow #2
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: Checkout webapp branch | |
uses: actions/checkout@v4 | |
with: | |
ref: webapp | |
path: webapp | |
fetch-depth: 1 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Get short Git commit hash | |
id: version | |
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- 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 "[email protected]" | |
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:[email protected]/spaces/QCDevs/selector HEAD:main --force |