dayglojago
dayglojago

Reputation: 21

Differentiate between two instances of the same repository using Github Actions by deploying them to different folders

Due to the relative simplicity of our site and limited resources, we're using one machine as both our development and staging server using a self-hosted github runner. It connects via SSH and runs actions triggered by pushes to two different branches. What I'd like to do is have two github actions scripts execute for two different branches of the same repository, we'll call them dev and stable for repository projectA. dev would deploy to ~/actions_runner/_work/projectA/projectA-dev and stable to ~/actions_runner/_work/projectA/projectA-stable, then use individual ENV files to connect them to the appropriate versions of their support services. It's unclear how to configure each script to rename the directory for their branch. Currently, the development workflow (a single script) deploys to ~/actions_runner/_work/projectA/projectA automatically... it seems like it should be possible to change the second instance of the repository name in the path to something more customized. Is it?

I looked at the github actions documentation about deploying to specific locations and haven't seen anything. I also searched github, reddit and google. Nothing I've found has helped! Thanks in advance.

Upvotes: 1

Views: 102

Answers (1)

VonC
VonC

Reputation: 1327004

It's unclear how to configure each script to rename the directory for their branch

Ideally, you do not rename anything, but use each action to checkout in your runner workspace to two different paths.

That way, you can use projectA-dev/stable in each action.

- name: Checkout tools repo
  uses: actions/checkout@v3
  with:
    repository: my-repo
    path: projectA-dev

Upvotes: 1

Related Questions