Skip to content
Latchkey

Bump versions workflow (chrisleekr/binance-trading-bot)

The Bump versions workflow from chrisleekr/binance-trading-bot, explained and optimized by Latchkey.

B

CI health: B - good

Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: chrisleekr/binance-trading-bot.github/workflows/bump-versions.ymlLicense MITView source

What it does

This is the Bump versions workflow from the chrisleekr/binance-trading-bot repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Bump versions

on: [workflow_dispatch]

jobs:
  bump-versions:
    name: Bump versions
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source code
        uses: actions/checkout@v2
      - id: bump-version
        name: Bump Version (Patch)
        if:
          github.repository == 'chrisleekr/binance-trading-bot' && github.ref ==
          'refs/heads/master'
        run: |
          git config --global user.email "${{ secrets.GIT_CI_EMAIL }}"
          git config --global user.name "$GITHUB_ACTOR"
          PACKAGE_VERSION=$(npm version patch -m "bump: update version to %s [skip ci]")
          git push https://$GITHUB_ACTOR:${{ secrets.GIT_CI_PASSWORD }}@${{ secrets.GIT_REPO_DOMAIN }}/chrisleekr/binance-trading-bot HEAD:$GITHUB_REF
          git push https://$GITHUB_ACTOR:${{ secrets.GIT_CI_PASSWORD }}@${{ secrets.GIT_REPO_DOMAIN }}/chrisleekr/binance-trading-bot $PACKAGE_VERSION
          echo "::set-output name=PACKAGE_VERSION::$PACKAGE_VERSION"
      - name: Trigger release workflow
        uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.GIT_REPO_ACCESS_TOKEN }}
          event-type: Release & Docker
          client-payload:
            '{"ref": "${{ steps.bump-version.outputs.PACKAGE_VERSION }}"}'

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Bump versions
 
on: [workflow_dispatch]
 
jobs:
  bump-versions:
    timeout-minutes: 30
    name: Bump versions
    runs-on: latchkey-small
    steps:
      - name: Checkout source code
        uses: actions/checkout@v2
      - id: bump-version
        name: Bump Version (Patch)
        if:
          github.repository == 'chrisleekr/binance-trading-bot' && github.ref ==
          'refs/heads/master'
        run: |
          git config --global user.email "${{ secrets.GIT_CI_EMAIL }}"
          git config --global user.name "$GITHUB_ACTOR"
          PACKAGE_VERSION=$(npm version patch -m "bump: update version to %s [skip ci]")
          git push https://$GITHUB_ACTOR:${{ secrets.GIT_CI_PASSWORD }}@${{ secrets.GIT_REPO_DOMAIN }}/chrisleekr/binance-trading-bot HEAD:$GITHUB_REF
          git push https://$GITHUB_ACTOR:${{ secrets.GIT_CI_PASSWORD }}@${{ secrets.GIT_REPO_DOMAIN }}/chrisleekr/binance-trading-bot $PACKAGE_VERSION
          echo "::set-output name=PACKAGE_VERSION::$PACKAGE_VERSION"
      - name: Trigger release workflow
        uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.GIT_REPO_ACCESS_TOKEN }}
          event-type: Release & Docker
          client-payload:
            '{"ref": "${{ steps.bump-version.outputs.PACKAGE_VERSION }}"}'
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow