Skip to content

Commit

Permalink
minor improvements for build workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuang authored and dhuang committed Jul 11, 2023
1 parent 0798c9e commit 85be753
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/build-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- 'main'
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build-nightly:
runs-on: ubuntu-22.04
Expand All @@ -15,7 +16,7 @@ jobs:
steps:
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::498127099666:role/WebIdentity-nm-github-actions-only
role-to-assume: ${{ secrets.AWS_WEBIDENTITY_FOR_GITHUB_ACTIONS }}
aws-region: us-east-1
- uses: actions/checkout@v3
- run: |
Expand All @@ -29,5 +30,13 @@ jobs:
make -B build
deactivate
ls dist/
aws s3 ls s3://nm-github-actions/
aws s3 cp dist/*nightly*.whl s3://nm-github-actions/transformers/
aws s3 cp dist/*nightly*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
todaytime=`date +%Y%m%d`
date '+%Y%m%d-%k:%M:%S' | tee log_${GITHUB_REF_NAME}_nightly_${todaytime}_${GITHUB_SHA:0:7}
aws s3 cp log_${GITHUB_REF_NAME}_nightly_${todaytime}_${GITHUB_SHA:0:7} s3://nm-github-actions/${{ github.event.repository.name }}/
oldDate=`date --date='-2 month' +%Y%m%d`
oldWhl=`(aws s3 ls s3://nm-github-actions/${{ github.event.repository.name }}/ | grep nightly | grep "${oldDate}") || echo "notfound"`
if [[ "${oldWhl}" != 'notfound' ]]; then
echo "Remove old build ${oldWhl}"
aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldWhl}
fi
12 changes: 7 additions & 5 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- 'release/[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
build-release:
runs-on: ubuntu-22.04
Expand All @@ -14,7 +14,7 @@ jobs:
steps:
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::498127099666:role/WebIdentity-nm-github-actions-only
role-to-assume: ${{ secrets.AWS_WEBIDENTITY_FOR_GITHUB_ACTIONS }}
aws-region: us-east-1
- uses: actions/checkout@v3
- run: |
Expand All @@ -25,9 +25,11 @@ jobs:
virtualenv venv
source venv/bin/activate
pip install -e .
sed -i 's/is_release = False/is_release = True/g' src/transformers/version.py
sed -i 's/is_release = False/is_release = True/g' src/${{ github.event.repository.name }}/version.py
make -B build
deactivate
ls dist/
aws s3 ls s3://nm-github-actions/
aws s3 cp dist/*.whl s3://nm-github-actions/transformers/
aws s3 cp dist/*.whl s3://nm-github-actions/${{ github.event.repository.name }}/
todaytime=`date +%Y%m%d`
date '+%Y%m%d-%k:%M:%S' | tee log_${GITHUB_REF_NAME}_release_${todaytime}_${GITHUB_SHA:0:7}
aws s3 cp log_${GITHUB_REF_NAME}_release_${todaytime}_${GITHUB_SHA:0:7} s3://nm-github-actions/${{ github.event.repository.name }}/

0 comments on commit 85be753

Please sign in to comment.