Composite github action, add binary to path

Advertisements

This is my github action o0th/get-version

name: get-version 
description: Get version from Cargo.toml

runs:
  using: composite
  steps:
    - shell: bash
      run: |
        curl -SLO https://github.com/o0th/get-version/releases/download/0.2.0/get-version
        chmod +x get-version
        # mv to bin?

My intent is to write a github action that download a binary and make it available to others:

---
name: testing 

on:
  push:
    branches:
      - master

jobs:
  testing:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: o0th/get-version@0.2.0
      - run: cat Cargo.toml | get-version
      - run: get-version

Instead of using something like supplypike/setup-bin

>Solution :

To add something to the path, you can issue a magic log command:

echo "$PWD/downloaded" >> $GITHUB_PATH

By using this command it doesn’t really matter where you put this just downloaded file, it can even be in a temporary folder, you then run the command above with the right path to the folder containing the executable and GitHub Actions will know where to find it for the duration of the rest of the job.

Leave a ReplyCancel reply