Hasan Iqbal commited on
Commit
eb7e1d8
1 Parent(s): ad40307

Added prerelease workflow and fixed github releases in release script

Browse files
.github/workflows/prerelease.yaml CHANGED
@@ -42,4 +42,37 @@ jobs:
42
  TWINE_USERNAME: __token__
43
  TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
44
  run: |
45
- twine upload dist/* --verbose
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  TWINE_USERNAME: __token__
43
  TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
44
  run: |
45
+ twine upload dist/* --verbose
46
+
47
+ huggingface_deploy:
48
+ name: Deploy to Hugging Face
49
+ runs-on: ubuntu-latest
50
+ needs: pypi_deploy
51
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
52
+ steps:
53
+ - name: Check out code
54
+ uses: actions/checkout@v3
55
+ with:
56
+ ref: ${{ github.head_ref }}
57
+ fetch-depth: 0
58
+
59
+ - name: Setup Git Config
60
+ run: |
61
+ git checkout main
62
+ git config --global user.email "[email protected]"
63
+ git config --global user.name "Hasan Iqbal"
64
+
65
+ - name: Enable HuggingFace Spaces Config
66
+ run: |
67
+ READMEFILE="README.md"
68
+ sed -i 's/<!--/---/g; s/-->/---/g' $READMEFILE
69
+ git add $READMEFILE
70
+ git commit -m "Uncommented HuggingFace Spaces Configuration" || echo "No changes to commit"
71
+
72
+ - name: Wait for 10 seconds
73
+ run: sleep 10
74
+
75
+ - name: Push to Hugging Face
76
+ env:
77
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
78
+ run: git push https://hasaniqbal777:[email protected]/spaces/hasaniqbal777/OpenFactCheck-Nightly main --force
scripts/release.sh CHANGED
@@ -107,7 +107,7 @@ bump2version patch --new-version $VERSION_BUMP --allow-dirty --verbose
107
 
108
  # Modify the docs version
109
  # Regex to match development or release candidate versions
110
- if [[ "$VERSION" =~ -dev[0-9]+$ || "$VERSION" =~ -rc[0-9]+$ ]]; then
111
  # It's a pre-release because it contains `dev` or `rc`
112
  c_echo $YELLOW "Skipping docs version bump for pre-release"
113
  else
@@ -129,12 +129,12 @@ git push origin $BRANCH
129
  git push origin $VERSION
130
 
131
  # Regex to match development or release candidate versions
132
- if [[ "$VERSION" =~ -dev[0-9]+$ ]]; then
133
  # It's a development release because it contains `dev`
134
  c_echo $YELLOW "Skipping release to GitHub for development release"
135
  exit 0
136
  fi
137
- if [[ "$VERSION" =~ -rc[0-9]+$ ]]; then
138
  # It's a pre-release because it contains `rc`
139
  gh release create "$VERSION" --generate-notes --prerelease
140
  echo "Pre-release $VERSION created."
 
107
 
108
  # Modify the docs version
109
  # Regex to match development or release candidate versions
110
+ if [[ "$VERSION" =~ dev[0-9]+$ || "$VERSION" =~ a[0-9]+$ || "$VERSION" =~ alpha[0-9]+$ || "$VERSION" =~ b[0-9]+$ || "$VERSION" =~ beta[0-9]+$ || "$VERSION" =~ rc[0-9]+$ ]]; then
111
  # It's a pre-release because it contains `dev` or `rc`
112
  c_echo $YELLOW "Skipping docs version bump for pre-release"
113
  else
 
129
  git push origin $VERSION
130
 
131
  # Regex to match development or release candidate versions
132
+ if [[ "$VERSION" =~ dev[0-9]+$ ]]; then
133
  # It's a development release because it contains `dev`
134
  c_echo $YELLOW "Skipping release to GitHub for development release"
135
  exit 0
136
  fi
137
+ if [[ "$VERSION" =~ a[0-9]+$ || "$VERSION" =~ alpha[0-9]+$ || "$VERSION" =~ b[0-9]+$ || "$VERSION" =~ beta[0-9]+$ || "$VERSION" =~ rc[0-9]+$ ]]; then
138
  # It's a pre-release because it contains `rc`
139
  gh release create "$VERSION" --generate-notes --prerelease
140
  echo "Pre-release $VERSION created."