Skip to content

Commit d7b02dc

Browse files
committed
test
1 parent 12f3638 commit d7b02dc

File tree

1 file changed

+86
-39
lines changed

1 file changed

+86
-39
lines changed

.github/workflows/CICD.yml

Lines changed: 86 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,57 +14,104 @@ jobs:
1414
- uses: actions/setup-python@v5
1515
with:
1616
python-version: "3.12"
17-
- name: Test
18-
run: |
19-
pip install -r requirements.txt
20-
pip install pytest
21-
pytest
17+
# - name: Test
18+
# run: |
19+
# pip install -r requirements.txt
20+
# pip install pytest
21+
# pytest
22+
23+
release:
24+
runs-on: ubuntu-latest
25+
needs: [test]
26+
steps:
27+
- name: Create Release
28+
uses: actions/github-script@v7
29+
with:
30+
script: |
31+
const refs = await github.rest.git.listMatchingRefs({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
ref: "tags/${{ github.head_ref }}-tag"
35+
})
36+
console.log(refs)
37+
if(refs.data.length > 0) {
38+
console.log("Tag already exists, skipping release")
39+
return
40+
}
41+
github.rest.repos.createRelease({
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
tag_name: "${{ github.head_ref }}-tag",
45+
name: "${{ github.head_ref }}",
46+
prerelease: true,
47+
target_commitish: "${{ github.head_ref }}"
48+
})
49+
env:
50+
GH_TOKEN: ${{ github.token }}
51+
2252
build:
2353
runs-on: ubuntu-latest
24-
needs: test
25-
if: github.ref == 'refs/heads/next' || github.ref == 'refs/heads/master'
54+
needs: release
55+
# if: github.ref == 'refs/heads/next' || github.ref == 'refs/heads/master'
2656
steps:
2757
- name: Checkout
2858
uses: actions/checkout@v4
2959
with:
3060
fetch-depth: 0
3161
token: ${{ secrets.TOKEN }}
32-
- name: Python Semantic Release
33-
uses: python-semantic-release/python-semantic-release@master
34-
id: semantic-release
62+
- uses: actions/setup-python@v5
3563
with:
36-
github_token: ${{ secrets.TOKEN }}
64+
python-version: "3.12"
65+
# - name: Python Semantic Release
66+
# uses: python-semantic-release/python-semantic-release@master
67+
# id: semantic-release
68+
# with:
69+
# github_token: ${{ secrets.TOKEN }}
3770
- name: Build
3871
run: |
3972
python3 -m pip install --upgrade build
4073
python3 -m build
41-
- name: Upload PYPI
42-
if: steps.semantic-release.outputs.released == 'true'
74+
- name: Upload GH
4375
run: |
44-
python3 -m pip install twine==6.0.1
45-
python3 -m twine upload --repository pypi dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
46-
- name: Setup NODE
47-
uses: actions/setup-node@v3
48-
with:
49-
registry-url: "https://registry.npmjs.org"
50-
node-version: "20.x"
51-
- name: Upload NPM
52-
if: steps.semantic-release.outputs.released == 'true'
53-
run: |
54-
pwd
55-
cd ${{ github.workspace }}
56-
npm i
57-
npm run json
58-
jq '.version="${{steps.semantic-release.outputs.version}}"' package.json > temp && mv temp package.json
59-
cat package.json
60-
npm publish
76+
git config --global --add safe.directory $GITHUB_WORKSPACE
77+
files="dist/*.whl"
78+
for file in $files
79+
do
80+
echo $file
81+
counter=0
82+
for i in 1 2 3 4 5; do gh release upload --clobber --repo $GITHUB_REPOSITORY ${{ github.head_ref }}-tag $file && break || counter=$[$counter +1] && sleep 30; done
83+
echo $counter
84+
if [ "$counter" -eq "5" ]; then exit 1; fi
85+
done
6186
env:
62-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63-
- name: Merge master -> next
64-
if: github.ref == 'refs/heads/master'
65-
uses: devmasx/merge-branch@master
66-
with:
67-
type: now
68-
from_branch: master
69-
target_branch: next
70-
github_token: ${{ secrets.TOKEN }}
87+
GITHUB_TOKEN: ${{ github.token }}
88+
# - name: Upload PYPI
89+
# if: steps.semantic-release.outputs.released == 'true'
90+
# run: |
91+
# python3 -m pip install twine==6.0.1
92+
# python3 -m twine upload --repository pypi dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
93+
# - name: Setup NODE
94+
# uses: actions/setup-node@v3
95+
# with:
96+
# registry-url: "https://registry.npmjs.org"
97+
# node-version: "20.x"
98+
# - name: Upload NPM
99+
# if: steps.semantic-release.outputs.released == 'true'
100+
# run: |
101+
# pwd
102+
# cd ${{ github.workspace }}
103+
# npm i
104+
# npm run json
105+
# jq '.version="${{steps.semantic-release.outputs.version}}"' package.json > temp && mv temp package.json
106+
# cat package.json
107+
# npm publish
108+
# env:
109+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
110+
# - name: Merge master -> next
111+
# if: github.ref == 'refs/heads/master'
112+
# uses: devmasx/merge-branch@master
113+
# with:
114+
# type: now
115+
# from_branch: master
116+
# target_branch: next
117+
# github_token: ${{ secrets.TOKEN }}

0 commit comments

Comments
 (0)