SPYT Release 2.4.1 #7
Workflow file for this run
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: Release SPYT | |
on: | |
push: | |
tags: | |
- 'spyt/2\.[0-9]+\.[0-9]+' | |
jobs: | |
start-vm: | |
name: Start VM | |
runs-on: trampoline | |
outputs: | |
label: ${{ steps.start-yc-runner.outputs.label }} | |
instance-id: ${{ steps.start-yc-runner.outputs.instance-id }} | |
steps: | |
- name: Start YC runner | |
id: start-yc-runner | |
uses: yc-actions/yc-github-runner@v1 | |
with: | |
mode: start | |
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }} | |
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
folder-id: ${{ vars.YC_FOLDER_ID }} | |
image-id: ${{ vars.YC_SPYT_IMAGE_ID }} | |
zone-id: ${{ vars.YC_ZONE_ID }} | |
subnet-id: ${{ vars.YC_SUBNET_ID }} | |
cores: 8 | |
memory: 16GB | |
core-fraction: 100 | |
disk-type: network-ssd-nonreplicated | |
disk-size: 93GB | |
checkout: | |
name: Checkout sources | |
needs: start-vm | |
runs-on: ${{ needs.start-vm.outputs.label }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
prepare_env: | |
name: Prepare environment | |
needs: | |
- start-vm | |
- checkout | |
runs-on: ${{ needs.start-vm.outputs.label }} | |
outputs: | |
release_version: ${{ steps.tag.outputs.RELEASE_VERSION }} | |
steps: | |
- name: Test deadsnakes | |
run: | | |
echo "FROM ubuntu:focal" > Dockerfile | |
head -25 tools/release/spyt_image/Dockerfile | tail +4 >> Dockerfile | |
docker build . | |
- name: Parse tag | |
id: tag | |
run: | | |
RELEASE_VERSION=$(echo ${GITHUB_REF#refs/*/*/}) | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT | |
echo "RELEASE_VERSION=$RELEASE_VERSION" | |
build_spyt: | |
name: Build SPYT artifacts | |
needs: | |
- start-vm | |
- prepare_env | |
runs-on: ${{ needs.start-vm.outputs.label }} | |
steps: | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
server-id: ossrh | |
server-username: OSSRH_USERNAME | |
server-password: OSSRH_PASSWORD | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg-passphrase: GPG_PASSWORD | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} | |
- name: Run sbt build | |
run: | | |
sbt -DconfigGeneration=False \ | |
-DcustomSpytVersion=${{ needs.prepare_env.outputs.release_version }} \ | |
spytBuildRelease | |
publish_to_pypi: | |
name: Publish SPYT artifacts to PyPi | |
needs: | |
- start-vm | |
- prepare_env | |
- build_spyt | |
if: ${{ always() && (needs.build_spyt.result == 'success') }} | |
runs-on: ${{ needs.start-vm.outputs.label }} | |
steps: | |
- name: Set up python | |
run: | | |
ln -sf /usr/bin/python3.11 /usr/bin/python3 | |
python3 -m pip install twine | |
python3 -m pip install ytsaurus-client==0.13.20 | |
- name: Publish to PyPi | |
run: | | |
sbt -Dpypi.password=${{ secrets.PYPI_API_TOKEN }} publishToPypi | |
publish_to_maven_central: | |
name: Publish SPYT artifacts to Maven Central | |
needs: | |
- start-vm | |
- prepare_env | |
- build_spyt | |
if: ${{ always() && (needs.build_spyt.result == 'success') }} | |
runs-on: ${{ needs.start-vm.outputs.label }} | |
steps: | |
- name: Write credentials | |
run: | | |
mkdir -p ~/.sbt | |
echo "realm=Sonatype Nexus Repository Manager" > ~/.sbt/.ossrh_credentials | |
echo "host=s01.oss.sonatype.org" >> ~/.sbt/.ossrh_credentials | |
echo "user=${{ secrets.OSSRH_USERNAME }}" >> ~/.sbt/.ossrh_credentials | |
echo "password=${{ secrets.OSSRH_PASSWORD }}" >> ~/.sbt/.ossrh_credentials | |
- name: Publish to Maven Central | |
run: | | |
sbt -Dgpg.passphrase=${{ secrets.GPG_PASSWORD }} publishToMavenCentral | |
build_and_publish_docker_image: | |
name: Build and publish SPYT docker image | |
needs: | |
- start-vm | |
- prepare_env | |
- build_spyt | |
if: ${{ always() && (needs.build_spyt.result == 'success') }} | |
runs-on: ${{ needs.start-vm.outputs.label }} | |
steps: | |
- name: Download Livy | |
run: | | |
cd build_output/ | |
wget https://storage.yandexcloud.net/ytsaurus-spyt/livy.tgz | |
- name: DockerHub login | |
shell: bash | |
run: | | |
echo '${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}' | docker login ghcr.io --username ${{ secrets.GH_USERNAME }} --password-stdin | |
- name: Build and push spyt docker image | |
run: | | |
cd tools/release/spyt_image | |
bash ./build.sh \ | |
--spyt-version ${{ needs.prepare_env.outputs.release_version }} | |
docker push ghcr.io/ytsaurus/spyt:${{ needs.prepare_env.outputs.release_version }} | |
stop-vm: | |
name: Stop VM | |
needs: | |
- start-vm | |
- publish_to_pypi | |
- publish_to_maven_central | |
- build_and_publish_docker_image | |
if: ${{ always() && needs.publish_to_pypi.result == 'success' && needs.publish_to_maven_central.result == 'success' && needs.build_and_publish_docker_image.result == 'success' }} | |
runs-on: trampoline | |
steps: | |
- name: Stop YC runner | |
uses: yc-actions/yc-github-runner@v1 | |
with: | |
mode: stop | |
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }} | |
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
label: ${{ needs.start-vm.outputs.label }} | |
instance-id: ${{ needs.start-vm.outputs.instance-id }} | |
send-notifications: | |
name: Send notifications | |
needs: | |
- stop-vm | |
runs-on: trampoline | |
if: ${{ failure() }} | |
steps: | |
- name: Send telegram message | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_CHAT_ID }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
disable_web_page_preview: true | |
format: markdown | |
message: | | |
Workflow *${{github.workflow}}* failed: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}. | |
Git ${{github.ref_type}}: *${{github.ref_name}}*. | |
Commit: | |
``` | |
${{github.event.head_commit.message}} | |
``` |