-
Notifications
You must be signed in to change notification settings - Fork 11
84 lines (78 loc) · 2.7 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Publish
on:
release:
types:
- created
jobs:
update-version-and-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Update version file
run: |
cat VERSION
echo "VERSION ${{ github.ref_name }}"
echo -n "${{ github.ref_name }}" > VERSION
- name: Update changelog file
run: |
echo "CHANGELOG"
- name: Commit updated files
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add VERSION CHANGELOG.md
git commit -m "Auto version and changelog update [${{ github.ref_name }}]"
git push origin
- name: Tag new commit
run: |
git tag --force ${{ github.ref_name }}
git push origin ${{ github.ref_name }} --force
update-release-github:
needs: update-version-and-changelog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Update Release description
run: |
echo "VERSION"
echo "CHANGELOG"
release-python-package:
needs: [update-version-and-changelog]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/codebleu
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Build wheel
run: |
python3 -m pip install --upgrade build
python3 -m build --wheel --sdist --outdir ./dist
- uses: pypa/gh-action-pypi-publish@release/v1
sync-to-hf-hub:
needs: update-version-and-changelog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download hf repo
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@users.noreply.github.com'
git clone https://k4black:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/k4black/codebleu hf_evaluate_codebleu
cd hf_evaluate_codebleu
git checkout main
- name: Update files and push
run: |
cp -r evaluate_app/* hf_evaluate_codebleu
cd hf_evaluate_codebleu
git add .
git commit --allow-empty -m "chore(auto): update changelog and version [${{ github.ref_name }}]"
ls -lah
git push https://k4black:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/k4black/codebleu main