-
Notifications
You must be signed in to change notification settings - Fork 12
95 lines (88 loc) · 3.11 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
85
86
87
88
89
90
91
92
93
94
95
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 '[email protected]'
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"
external-build-workflow:
needs: update-version-and-changelog
uses: ./.github/workflows/reusable-build.yml
with:
CIBW_SKIP: "pp* cp36-* cp37-*"
CIBW_BUILD: "cp*-macosx* cp*-manylinux* cp*-win*"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_LINUX: "x86_64 aarch64"
CIBW_ARCHS_WINDOWS: "x86"
VERSION: ${{ github.ref_name }}
secrets: inherit
release-python-package:
needs: [external-build-workflow, 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/download-artifact@v4
with:
name: artifact # if `name: artifact` is omitted, the action will create extra parent dir
path: 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 '[email protected]'
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