GitHub Actions Docker Pull Variable Substitution

GitHub Actions Script:

name: DigitalOceanCI

on:
  pull_request:
    branches:
      - master

jobs:
  DockerDroplet:

    runs-on: ubuntu-latest
    env:
        dockerHubUsername: ${{secrets.dockerHubUsername}}
        dockerHubPassword: ${{secrets.dockerHubPassword}}
        dockerHubContainerName: ${{secrets.dockerHubContainerName}}
        digitalOceanIP: ${{secrets.digitalOceanIP}}
        domain: ${{secrets.domain}}
    steps:
    - uses: actions/checkout@v1
    - name: Digital Ocean Preparation - Pull Website Container From Docker Hub and Publish to Digital Ocean Droplet
      run: ssh -o "StrictHostKeyChecking=no" -i key.txt root@${{secrets.digitalOceanIP}} 'bash -s' < scripts/containermaint.sh

Bash Script - containermaint.sh

#!/bin/bash
docker pull $dockerHubUsername/$dockerHubContainerName

I don’t have issues with other variables. Maybe it is the “/” or the concatenation of the variables? Even if I hard code the two environment variables in the GitHub Actions script, the result is the same. It doesn’t work. Any quick tip would be great. I’ve tried single quotes, double quotes, and it’s driving me crazy. Hard coding the variables in the bash script to the actual container name makes it work, but it would be cleaner if I could use the variables from the Actions script.

Forgot to export variables…

  • name: Digital Ocean Preparation - Pull Website Container From Docker Hub and Publish to Digital Ocean Droplet
    run: ssh -o “StrictHostKeyChecking=no” -i key.txt root@${{secrets.digitalOceanIP}} export dockerHubUsername=${{secrets.dockerHubUsername}}; export dockerHubContainerName=${{secrets.dockerHubContainerName}}; scripts/containermaint.sh

Now it works