diff --git a/.github/workflows/docker-ghcr.yml b/.github/workflows/docker-ghcr.yml index 53c925c3..193f027e 100644 --- a/.github/workflows/docker-ghcr.yml +++ b/.github/workflows/docker-ghcr.yml @@ -1,14 +1,15 @@ name: Publish a Docker image to ghcr.io on: - push: - tags: - - v*.*.* + release: + types: + - published jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - run: echo "REPO=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + - run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Enable buildx uses: docker/setup-buildx-action@v1 - name: Login @@ -22,4 +23,10 @@ jobs: with: context: . push: true - tags: ghcr.io/${{ env.REPO }}:latest + tags: ghcr.io/${{ env.REPO }}:${{ env.TAG }} + - name: Docker build/push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ghcr.io/${{ env.REPO }}:latast diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 00000000..0dfcddd2 --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,43 @@ +name: Build Python distributions and create GitHub Release + +on: + push: + tags: + - v*.*.* + +jobs: + github-release: + name: Build and publish Python distributions to TestPyPI and PyPI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: '16' + - run: npm install + - run: npm run build:prd + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install --progress-bar off wheel twine + - run: python setup.py sdist bdist_wheel + - run: twine check dist/* + + - name: Create GitHub release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + wget https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz + tar -xzf ghr_v*_linux_amd64.tar.gz + export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH" | sed -e "s/refs\/tags\///") + + cp ./optuna_dashboard/public/bundle.js ./dist/ + cp ./optuna_dashboard/public/bundle.js.LICENSE.txt ./dist/ + ./ghr_v0.13.0_linux_amd64/ghr -n ${TAGNAME} -b ${TAGNAME} -draft ${TAGNAME} dist/ diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 607a7c80..d98c14bc 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,12 +1,12 @@ name: Build Python distributions and publish to PyPI on: - push: - tags: - - v*.*.* + release: + types: + - published jobs: - build-and-publish: + pypi: name: Build and publish Python distributions to TestPyPI and PyPI runs-on: ubuntu-latest steps: @@ -35,15 +35,3 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_PASSWORD }} - - - name: Create GitHub release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - wget https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz - tar -xzf ghr_v*_linux_amd64.tar.gz - export TAGNAME=$(jq --raw-output .ref "$GITHUB_EVENT_PATH" | sed -e "s/refs\/tags\///") - - cp ./optuna_dashboard/public/bundle.js ./dist/ - cp ./optuna_dashboard/public/bundle.js.LICENSE.txt ./dist/ - ./ghr_v0.13.0_linux_amd64/ghr -n ${TAGNAME} -b ${TAGNAME} -draft ${TAGNAME} dist/