|
1 | | -name: Release Bot |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - master |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: "Version (e.g., v0.24.0)" |
| 8 | + required: true |
| 9 | + commit: |
| 10 | + description: "Commit (e.g., 92b44e1)" |
| 11 | + required: true |
7 | 12 |
|
8 | 13 | jobs: |
9 | 14 | release: |
10 | | - name: README.md |
| 15 | + name: Release |
11 | 16 | runs-on: ubuntu-latest |
12 | 17 | steps: |
13 | 18 | - uses: actions/checkout@v2 |
14 | 19 | with: |
15 | 20 | fetch-depth: 0 |
16 | | - - run: git tag |
17 | | - - run: python3 tools/release/note_create.py |
18 | | - - run: git diff |
19 | | - - run: python3 tools/release/note_update.py |
20 | | - - run: git diff |
21 | | - - uses: peter-evans/create-pull-request@v3 |
| 21 | + - run: | |
| 22 | + set -x -e |
| 23 | + COMMIT=$(git rev-parse --quiet --verify ${{ github.event.inputs.commit }}) |
| 24 | + if [[ "$(git tag -l ${{ github.event.inputs.version }})" == "${{ github.event.inputs.version }}" ]]; then |
| 25 | + echo "${{ github.event.inputs.version }} already released" |
| 26 | + exit 1 |
| 27 | + fi |
| 28 | + VERSION=${{ github.event.inputs.version }} |
| 29 | +
|
| 30 | + docker pull tfsigio/candidate:${VERSION:1} |
| 31 | + docker create -it --name storage tfsigio/candidate:${VERSION:1} bash |
| 32 | + docker cp storage:/wheelhouse . |
| 33 | + docker cp storage:/wheelhouse.sha256 . |
| 34 | + docker cp storage:/wheelhouse.commit . |
| 35 | + docker cp storage:/wheelhouse.version . |
| 36 | +
|
| 37 | + sha256sum wheelhouse/*.whl | sort -u | diff wheelhouse.sha256 - |
| 38 | + mv wheelhouse dist |
| 39 | +
|
| 40 | + if [[ "${COMMIT}" != "$(cat wheelhouse.commit)" ]]; then |
| 41 | + echo "${COMMIT} != $(cat wheelhouse.commit)" |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | + if [[ "${VERSION}" != "v$(cat wheelhouse.version)" ]]; then |
| 45 | + echo "${VERSION} != v$(cat wheelhouse.version)" |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | +
|
| 49 | + python3 tools/release/note_take.py ${VERSION} |
| 50 | +
|
| 51 | + echo "::set-output name=tag::${VERSION}" |
| 52 | + echo "::set-output name=name::TensorFlow I/O ${VERSION:1}" |
| 53 | + echo "::set-output name=commit::${COMMIT}" |
| 54 | + id: info |
| 55 | + - run: | |
| 56 | + set -x -e |
| 57 | + echo ${{ steps.info.outputs.tag }} |
| 58 | + echo ${{ steps.info.outputs.name }} |
| 59 | + echo ${{ steps.info.outputs.commit }} |
| 60 | + cat CURRENT.md |
| 61 | + - uses: softprops/action-gh-release@v1 |
| 62 | + with: |
| 63 | + body_path: CURRENT.md |
| 64 | + name: ${{ steps.info.outputs.name }} |
| 65 | + tag_name: ${{ steps.info.outputs.tag }} |
| 66 | + target_commitish: ${{ steps.info.outputs.commit }} |
| 67 | + draft: true |
| 68 | + - uses: pypa/gh-action-pypi-publish@master |
22 | 69 | with: |
23 | | - commit-message: Update RELEASE.md [bot] |
24 | | - branch: bot-RELEASE.md |
25 | | - delete-branch: true |
26 | | - title: 'Update RELEASE.md [bot]' |
27 | | - body: | |
28 | | - README.md: auto-updated by .github/workflows/release.yml |
| 70 | + user: __token__ |
| 71 | + password: ${{ secrets.TEST_PYPI_TOKEN }} |
| 72 | + repository_url: https://test.pypi.org/legacy/ |
| 73 | + #- uses: pypa/gh-action-pypi-publish@master |
| 74 | + # with: |
| 75 | + # user: __token__ |
| 76 | + # password: ${{ secrets.PYPI_TOKEN }} |
| 77 | + |
0 commit comments