Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Composite github action, add binary to path

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading