Github Actions

Written
  • Each workflow is in a YAML file
  • Here's an example that builds Rust binaries for each platform
    • name: Build release binaries
      
      # The events to trigger the workflow
      # repository_dispatch is a manual trigger that you do via an API call
      on:
        repository_dispatch:
          types: [tag-created]
      
      jobs:
        # Can define multiple jobs
        release:
          name: Build and Release
          runs-on: ${{ matrix.os }}
          strategy:
            matrix:
              include:
                - os: ubuntu-latest
                  artifact_name: export-roam-notes
                  asset_name: export-roam-notes-linux-amd64
                - os: macos-latest
                  artifact_name: export-roam-notes
                  asset_name: export-roam-notes-macos-amd64
                - os: windows-latest
                  artifact_name: export-roam-notes.exe
                  asset_name: export-roam-notes-windows-amd64.exe
          steps:
            - name: Checkout
              uses: actions/checkout@v2
            - name: Build
              run: cargo build --release --locked
            - name: Upload binary
              uses: svenstaro/upload-release-action@v1-release
              with:
                repo_token: ${{ secrets.GITHUB_TOKEN }}
                file: target/release/${{ matrix.artifact_name }}
                asset_name: ${{ matrix.asset_name }}
                tag: ${{ github.event.client_payload.new_version }}
  • Manually Triggering Workflows

Thanks for reading! If you have any questions or comments, please send me a note on Twitter. And if you enjoyed this, I also have a newsletter where I send out interesting things I read and the occasional nature photo.

You can check out a recent issue, or enter your email below to subscribe.