Fix failing HF upload #22
Workflow file for this run
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: Deployment on DockerHub and Hugging Face | |
# Trigger the workflow on push and pull request events to the 'main' or 'master' branch | |
on: | |
push: | |
branches: | |
- "master" | |
- "main" | |
pull_request: | |
branches: | |
- "master" | |
- "main" | |
jobs: | |
build-and-deploy: | |
# Run the job on the latest Ubuntu runner | |
runs-on: ubuntu-latest | |
name: Push Docker image to Docker Hub and Hugging Face | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Set up Git LFS | |
run: | | |
git lfs install | |
git lfs pull | |
- name: Remove binary files from git history | |
run: | | |
git filter-branch --force --index-filter \ | |
"git rm --cached --ignore-unmatch DiverseSelector/test/test2/BBB_SECFP6_1024.xlsx DiverseSelector/test/test2/BBB_SECFP6_2048.xlsx" \ | |
--prune-empty --tag-name-filter cat -- --all | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# - name: Extract metadata (tags, labels) for Docker | |
# id: meta | |
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
# with: | |
# images: my-docker-hub-namespace/my-docker-hub-repository | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
# tags: ${{ steps.meta.outputs.tags }} | |
# labels: ${{ steps.meta.outputs.labels }} | |
# * name: Generate artifact attestation | |
# uses: actions/attest-build-provenance@v1 | |
# with: | |
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | |
# subject-digest: ${{ steps.push.outputs.digest }} | |
# push-to-registry: true | |
# Step 8: Replace the README.md file for Hugging Face | |
- 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" | |
# Step 9: Push the app to Hugging Face | |
- name: Push to Hugging Face | |
env: | |
APP: ${{ secrets.APP }} | |
run: | | |
git push https://QCDevs:$APP@huggingface.co/spaces/QCDevs/selector HEAD:main --force |