Since I recently fell in love with nushell it makes sense to have this available on my workflows.
This kinde of action will perform action using the base image you have set in your workflow.
Example of a simple Workflow using the latest ubuntu image as the base environment to execute a nushell script that handles the test execution routines.
# .github/workflows/running_ci_routines.yml @ https://github.com/JaneDoe82/my-new-app
name: running ci routines
on: [push]
jobs:
running_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Running Test Routines
run: nu testing.nu
On the current set of steps the last one (Running Test Routines) will fail
since nushell does not come installed by default.
If you try to install it by sudo apt install -y nushell it won't work since
nushell is not a core package as well.
For that to work we need to setup the apt repositories:
wget -qO- https://apt.fury.io/nushell/gpg.key | \
sudo gpg --dearmor -o /etc/apt/keyrings/fury-nushell.gpg
echo "deb [signed-by=/etc/apt/keyrings/fury-nushell.gpg] https://apt.fury.io/nushell/ /" | \
sudo tee /etc/apt/sources.list.d/fury.list
and then
sudo apt update && apt install nushell
Since we are going to make use of that on other projects we will set this as a reusable Action.
First we will create new repo: https://github.com/JaneDoe/setup-nushell and
then create a new action.yml at the root:
# action.yml @ https://github.com/JaneDoe/setup-nushell
name: "Setup Nushell"
description: "Installing Nushell through APT Repositories"
runs:
using: "composite"
steps:
- name: Setup Repositories
shell: bash
run: |
wget -qO- https://apt.fury.io/nushell/gpg.key | \
sudo gpg --dearmor -o /etc/apt/keyrings/fury-nushell.gpg
echo "deb [signed-by=/etc/apt/keyrings/fury-nushell.gpg] https://apt.fury.io/nushell/ /" | \
sudo tee /etc/apt/sources.list.d/fury.list
- name: Installing Nushell
shell: bash
run: |
sudo apt update && apt install -y nushell
Once you finish pushing action.yml to the new repo JaneDoe/setup-nushell
you need to also set a tag. Recommend using semver pattern
git tag v0.1.0
git push --tags`
Now we can adjust our original Workflow:
# .github/workflows/running_ci_routines.yml @ https://github.com/JaneDoe82/my-new-app
name: running ci routines
on: [push]
jobs:
running_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: JaneDoe82/setup-nushell@v0.1.0
- name: Running Test Routines
run: nu testing.nu
Navigate to: Settings > Actions > General
and then scroll down to the Access section and select whichever option fits better for your privacy scenario.