Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 1a33c78

Browse files
dhuangnmdhuang
authored andcommitted
minor improvements for build workflow files (#83)
Co-authored-by: dhuang <[email protected]>
1 parent 7c04f76 commit 1a33c78

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

.github/workflows/build-nightly.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- 'main'
77
schedule:
88
- cron: '0 0 * * *'
9+
workflow_dispatch:
910
jobs:
1011
build-nightly:
1112
runs-on: ubuntu-22.04
@@ -15,7 +16,7 @@ jobs:
1516
steps:
1617
- uses: aws-actions/configure-aws-credentials@v2
1718
with:
18-
role-to-assume: arn:aws:iam::498127099666:role/WebIdentity-nm-github-actions-only
19+
role-to-assume: ${{ secrets.AWS_WEBIDENTITY_FOR_GITHUB_ACTIONS }}
1920
aws-region: us-east-1
2021
- uses: actions/checkout@v3
2122
- run: |
@@ -29,5 +30,13 @@ jobs:
2930
make -B build
3031
deactivate
3132
ls dist/
32-
aws s3 ls s3://nm-github-actions/
33-
aws s3 cp dist/*nightly*.whl s3://nm-github-actions/transformers/
33+
aws s3 cp dist/*nightly*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
34+
todaytime=`date +%Y%m%d`
35+
date '+%Y%m%d-%k:%M:%S' | tee log_${GITHUB_REF_NAME}_nightly_${todaytime}_${GITHUB_SHA:0:7}
36+
aws s3 cp log_${GITHUB_REF_NAME}_nightly_${todaytime}_${GITHUB_SHA:0:7} s3://nm-github-actions/${{ github.event.repository.name }}/
37+
oldDate=`date --date='-2 month' +%Y%m%d`
38+
oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"`
39+
if [[ "${oldWhl}" != 'notfound' ]]; then
40+
echo "Remove old build ${oldWhl}"
41+
aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldWhl}
42+
fi

.github/workflows/build-release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- 'release/[0-9]+.[0-9]+'
7-
7+
workflow_dispatch:
88
jobs:
99
build-release:
1010
runs-on: ubuntu-22.04
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- uses: aws-actions/configure-aws-credentials@v2
1616
with:
17-
role-to-assume: arn:aws:iam::498127099666:role/WebIdentity-nm-github-actions-only
17+
role-to-assume: ${{ secrets.AWS_WEBIDENTITY_FOR_GITHUB_ACTIONS }}
1818
aws-region: us-east-1
1919
- uses: actions/checkout@v3
2020
- run: |
@@ -25,9 +25,11 @@ jobs:
2525
virtualenv venv
2626
source venv/bin/activate
2727
pip install -e .
28-
sed -i 's/is_release = False/is_release = True/g' src/transformers/version.py
28+
sed -i 's/is_release = False/is_release = True/g' src/${{ github.event.repository.name }}/version.py
2929
make -B build
3030
deactivate
3131
ls dist/
32-
aws s3 ls s3://nm-github-actions/
33-
aws s3 cp dist/*.whl s3://nm-github-actions/transformers/
32+
aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
33+
todaytime=`date +%Y%m%d`
34+
date '+%Y%m%d-%k:%M:%S' | tee log_${GITHUB_REF_NAME}_release_${todaytime}_${GITHUB_SHA:0:7}
35+
aws s3 cp log_${GITHUB_REF_NAME}_release_${todaytime}_${GITHUB_SHA:0:7} s3://nm-github-actions/${{ github.event.repository.name }}/

0 commit comments

Comments
 (0)