name: Sync to Hugging Face hub on: push: branches: - main pull_request: branches: - main # to run this workflow manually from the Actions tab workflow_dispatch: env: api_secret: ${{ secrets.HF }} jobs: Build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 # Set up Python 3.11 environment - name: Set up Python 3.11 uses: actions/setup-python@v4 with: python-version: "3.11" # Install dependencies - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Model Testing run: | python3 inference.py DeployDev: name: Deploy to Development needs: [Build] runs-on: ubuntu-latest environment: name: Staging url: 'https://huggingface.co/spaces/cccmatthew/gp30-dev' steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Add remote env: HF: ${{ secrets.HF }} run: git remote add space https://cccmatthew:$HF@huggingface.co/spaces/cccmatthew/gp30-dev - name: Push to hub env: HF: ${{ secrets.HF }} run: git push --force https://cccmatthew:$HF@huggingface.co/spaces/cccmatthew/gp30-dev main DeployProd: name: Deploy to Production needs: [DeployDev] runs-on: ubuntu-latest environment: name: Production url: 'https://huggingface.co/spaces/cccmatthew/gp30-deployment' steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Add remote env: HF: ${{ secrets.HF }} run: git remote add space https://cccmatthew:$HF@huggingface.co/spaces/cccmatthew/gp30-deployment - name: Push to hub env: HF: ${{ secrets.HF }} run: git push --force https://cccmatthew:$HF@huggingface.co/spaces/cccmatthew/gp30-deployment main