DEV Community

Cover image for Sync your Spotify to Slack status
Gio
Gio

Posted on

Sync your Spotify to Slack status

This is a an open-source project that serves as both website as well as a backend for Slack app that synchronizes Spotify song to your Slack status.

My Workflow

GitHub workflow master.yml:

  1. Workflow sets up appropriate environment using actions/checkout and actions/setup-java.
  2. After that the gradle packages are cached via actions/cache@v2
  3. Gradle properties file is read via christian-draeger/read-properties, so that final deployment file can inherit proper semantic version
  4. Once the build is finished and the final zip file is generated, artifact is deployed to AWS beanstalk via einaregilsson/beanstalk-deploy. AWS credentials are passed via Github secrets

As a result, workflow deploys a new version of the application to AWS beanstalk as soon as a change is detected on master branch.

    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
          java-version: 11.0.4
      - name: Cache Gradle packages
        uses: actions/cache@v2
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
          restore-keys: ${{ runner.os }}-gradle
      - name: Grant execute permission for gradlew
        run: chmod +x gradlew
      - name: Build with Gradle
        run: ./gradlew build
      - name: Read baseVersion from gradle.properties
        id: read_artifact_version
        uses: christian-draeger/read-properties@1.0.1
        with:
          path: './gradle.properties'
          property: 'baseVersion'

      - name: Generate deployment package
        run: zip -j spotmystatus.zip backend/build/libs/spotmystatus-${{ steps.read_artifact_version.outputs.value }}.jar backend/Procfile && cd backend && zip -r ../spotmystatus.zip .ebextensions .platform
      - name: Deploy to AWS Beanstalk
        uses: einaregilsson/beanstalk-deploy@v13
        with:
          aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          application_name: SpotMyStatus
          environment_name: spotmystatus-environment
          version_label: ${{ steps.read_artifact_version.outputs.value }}-${{ github.run_id }}-${{ github.run_number }}
          use_existing_version_if_available: false
          wait_for_environment_recovery: 180
          region: eu-central-1
          deployment_package: spotmystatus.zip
Enter fullscreen mode Exit fullscreen mode

Submission Category:

Wacky Wildcards: automate build and deployment of an artifact to AWS Beanstalk

Link to workflow yaml file

Workflow yaml file for master branch

Repository

GitHub logo giorgimode / SpotMyStatus

Slack App updating user's status with currently playing song from Spotify

SpotMyStatus

Slack App updating user's status with currently playing song from Spotify

App Home page

here

Bugs, Feature Requests

Feel free to create a support ticket via home page or to add a ticket directly in the issue tracker

SpotMyStatus app commands

Following parameters can be passed to /spotme command in Slack

  • /spotme pause
  • /spotme play
  • /spotme purge
  • /spotme help

SpotMyStatus customization

Customize your experience by running /spotme command or by accessing app Home Tab SpotMyStatus Home Tab Screenshot

NOTE: The syncing hours feature displayed here uses Slack's time picker element, which is a beta feature and not supported on apps in Slack App Directory. As soon as this element becomes official, syncing hours field will be reactivated.

Features

  • User can pause/play status syncing
  • User can choose to sync music and/or podcasts (default both)
  • User can define emojis to rotate from when app sets a status. Emojis not present in the workspace will not be…

Additional Resources / Info

Top comments (0)