| | name: Fairseq Release |
| |
|
| | on: |
| | workflow_dispatch: |
| | inputs: |
| | name: |
| | description: 'Release Type' |
| | default: 'patch' |
| | required: true |
| |
|
| | jobs: |
| |
|
| | get_next_version: |
| | runs-on: ubuntu-latest |
| | steps: |
| | - name: checkout-repo-content |
| | uses: actions/checkout@v2 |
| |
|
| | - name: setup-python |
| | uses: actions/setup-python@v2 |
| | with: |
| | python-version: 3.8 |
| |
|
| | - name: get next version and tag |
| | id: get-next-version-and-tag |
| | run: | |
| | output=$(python3 release_utils.py --release-type ${{ github.event.inputs.name }}) |
| | echo $output |
| | new_version=$(echo $output | awk '{print $1}') |
| | new_tag=$(echo $output | awk '{print $2}') |
| | echo "new version is $new_version" |
| | echo "new tag is $new_tag" |
| | echo ::set-output name=version::$new_version |
| | echo ::set-output name=tag::$new_tag |
| | echo ::set-output name=branch_name::$new_version-release |
| | echo "NEW_TAG=$new_tag" >> $GITHUB_ENV |
| | echo "NEW_BRANCH=$new_version-release" >> $GITHUB_ENV |
| | |
| |
|
| | |
| | - name: update version |
| | id: update-version |
| | run : | |
| | echo "current folder = $PWD" |
| | echo "current branch = $(git branch --show-current)" |
| | output=$(python3 release_utils.py --release-type ${{ github.event.inputs.name }} --update-version) |
| | |
| | - name: add and commit |
| | uses: EndBug/add-and-commit@v9 |
| | with: |
| | author_name: ${{ secrets.AUTHOR_NAME }} |
| | author_email: ${{ secrets.AUTHOR_EMAIL }} |
| |
|
| | |
| | new_branch: '${{ env.NEW_BRANCH }}' |
| | default_author: github_actor |
| | message: '${{ env.NEW_TAG }} release' |
| | pathspec_error_handling: exitAtEnd |
| |
|
| | |
| | |
| | tag: '${{ env.NEW_TAG }}' |
| |
|
| | outputs: |
| | new_version: ${{ steps.get-next-version-and-tag.outputs.version }} |
| | new_tag: ${{ steps.get-next-version-and-tag.outputs.tag }} |
| | branch_name: ${{ steps.get-next-version-and-tag.outputs.branch_name }} |
| |
|
| | create_sdist: |
| | runs-on: ubuntu-latest |
| | name: Create Source Distribution |
| | needs: get_next_version |
| | steps: |
| | - uses: actions/checkout@v3 |
| | with: |
| | ref: ${{ needs.get_next_version.outputs.branch_name }} |
| |
|
| | - name: Install Python |
| | uses: actions/setup-python@v2 |
| | with: |
| | python-version: '3.8' |
| |
|
| | - name: Upgrade pip |
| | run: | |
| | python3 -m pip install --upgrade pip |
| | |
| | - name: Create Source Distribution |
| | run: | |
| | python3 -m pip install setuptools wheel twine torch |
| | python3 setup.py sdist |
| | |
| | - uses: actions/upload-artifact@v2 |
| | with: |
| | path: dist/*.tar.gz |
| |
|
| | build_wheels: |
| | name: Build wheels on ${{ matrix.os }} |
| | runs-on: ${{ matrix.os }} |
| | needs: get_next_version |
| | strategy: |
| | matrix: |
| | os: [ubuntu-latest, macos-latest] |
| |
|
| | steps: |
| | - uses: actions/checkout@v3 |
| | with: |
| | ref: ${{ needs.get_next_version.outputs.branch_name }} |
| |
|
| | - name: Install Python |
| | uses: actions/setup-python@v2 |
| | with: |
| | python-version: '3.8' |
| |
|
| | - name: Upgrade pip |
| | run: | |
| | python3 -m pip install --upgrade pip |
| | |
| | - name: Install cibuildwheel |
| | run: | |
| | python3 -m pip install cibuildwheel |
| | |
| | - name: Build wheels for CPython |
| | run: | |
| | python3 -m cibuildwheel --output-dir dist |
| | env: |
| | CIBW_BUILD: "cp38-*64" |
| | CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 |
| | CIBW_BEFORE_BUILD: git submodule update --init --recursive && pip install . |
| | |
| | CIBW_BEFORE_BUILD_LINUX: (yum install -y libffi-devel || apt-get install -y libffi-devel || apk add --update --no-cache libffi-devel || true) && (yum install -y libc6 || apt-get install -y libc6 || apk add --update --no-cache libc6 || true) |
| | CIBW_ENVIRONMENT: "PIP_ONLY_BINARY=numpy" |
| | CIBW_SKIP: "*musllinux*" |
| |
|
| | - uses: actions/upload-artifact@v2 |
| | with: |
| | path: dist |
| |
|
| | upload: |
| | name: Upload to PyPi and create release |
| | runs-on: ubuntu-latest |
| | needs: [build_wheels, create_sdist, get_next_version] |
| | steps: |
| | - uses: actions/download-artifact@v2 |
| | with: |
| | name: artifact |
| | path: dist |
| |
|
| | |
| | - name: upload |
| | env: |
| | TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
| | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| | run: | |
| | pip install setuptools wheel twine |
| | python3 -m twine upload --repository pypi dist/* |
| | |
| | |
| | - name: create release on github |
| | uses: ncipollo/release-action@v1 |
| | with: |
| | tag: '${{ needs.get_next_version.outputs.new_tag }}' |
| |
|