build-nightly is to create nightly wheel file for pypi #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-nightly | |
run-name: ${{ github.workflow }} is to create nightly wheel file for pypi | |
on: | |
push: | |
branches: | |
- 'main' | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
build-nightly: | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: ${{ secrets.AWS_WEBIDENTITY_FOR_GITHUB_ACTIONS }} | |
aws-region: us-east-1 | |
- uses: actions/checkout@v3 | |
- run: | | |
pwd | |
sudo apt-get install python3-pip | |
pip3 --version | |
sudo pip3 install virtualenv | |
virtualenv venv | |
source venv/bin/activate | |
pip install -e . | |
make -B build | |
deactivate | |
ls dist/ | |
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 | |
for oldwhl in $(echo "${oldWhl}" | awk '{print $4}') | |
do | |
echo "Remove old build ${oldwhl}" | |
aws s3 rm s3://nm-github-actions/${{ github.event.repository.name }}/${oldwhl} | |
done | |
fi |