How to implement ./cloud_sql_proxy in GitHub Actions?

Viewed 117
jobs:
  job1:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v2

    - name: Download Cloud SQL Auth Proxy
      run: |
        wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
        chmod +x cloud_sql_proxy

  job2:
    needs: job1
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: ./cloud_sql_proxy \
              -instances=...

I got this error:

./cloud_sql_proxy: No such file or directory

I wanna separate job1 and job2.

How can I use ./cloud_sql_proxy command in job2?

1 Answers

Github jobs do not share files or data unless you take action to do so. One of the reasons is they can run in parallel on different systems/containers/computers.

There are several options. The easiest is to create a step in job2 that does the same download as the step in job1. Other options include workflow artifacts (upload and download) and cache.

Related