unsek

unsek

Edeliver: Error when building release through GitHub Actions

So I’m trying to get Github Actions to build a release in a DO droplet. I’m able to SSH into the droplet using the SSH private key as the user config is using. I’m not really sure if the error is SSH-related or not.

action yml:

name: CD

on:
  push:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-elixir@v1
      with:
        otp-version: 22.3
        elixir-version: 1.10.2
    - uses: webfactory/ssh-agent@v0.2.0
      with:
        ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

    - name: Install dependencies
      run: mix deps.get

    - name: Build and deploy production release
      run: |
        mix edeliver build release production --verbose
        mix edeliver deploy release to production --verbose
        mix edeliver migrate production --verbose
        mix edeliver start production --verbose
      env:
        HOST: ${{ secrets.HOST }}
        USERNAME: ${{ secrets.USERNAME }}

edeliver logs:

-----> Ensuring hosts are ready to accept git pushes
bash is installed and the default shell
Initialized empty Git repository in /tmp/edeliver/app/builds/.git/
-----> Pushing new commits with git to: ***@***
error: src refspec master does not match any
error: failed to push some refs to '***@***:/tmp/edeliver/app/builds'

FAILED 1:
git push --tags -f ***@*** master

##[error]Process completed with exit code 1.

edeliver config:

#!/bin/bash

 APP="app"

 BUILD_HOST=$HOST
 BUILD_USER=$USERNAME
 BUILD_AT="/tmp/edeliver/$APP/builds"

 START_DEPLOY=true
 CLEAN_DEPLOY=true
 
 # prevent re-installing node modules; this defaults to "."
 GIT_CLEAN_PATHS="_build rel priv/static"

 PRODUCTION_HOSTS=$HOST
 PRODUCTION_USER=$USERNAME
 DELIVER_TO="/home/$USERNAME/apps"

 # For Phoenix projects, symlink prod.secret.exs to our tmp source
 pre_erlang_get_and_update_deps() {
   local _prod_secret_path="/home/$USERNAME/apps/$APP/secret/prod.secret.exs"
   if [ "$TARGET_MIX_ENV" = "prod" ]; then
     status "Linking '$_prod_secret_path'"
     __sync_remote "
       [ -f ~/.profile ] && source ~/.profile
       mkdir -p '$BUILD_AT'
       ln -sfn '$_prod_secret_path' '$BUILD_AT/config/prod.secret.exs'
     "
   fi
    }

 pre_erlang_clean_compile() {
   status "Running npm install"
     __sync_remote "
       [ -f ~/.profile ] && source ~/.profile
       set -e
       cd '$BUILD_AT'/assets
       npm install
     "

   status "Compiling assets"
      __sync_remote "
       [ -f ~/.profile ] && source ~/.profile
       set -e
       cd '$BUILD_AT'/assets
       node_modules/.bin/webpack --mode production --silent
     "

   status "Running phoenix.digest" # log output prepended with "----->"
   __sync_remote " # runs the commands on the build host
     [ -f ~/.profile ] && source ~/.profile # load profile (optional)
     set -e # fail if any command fails (recommended)
     cd '$BUILD_AT' # enter the build directory on the build host (required)
          # prepare something
     mkdir -p priv/static # required by the phoenix.digest task
     # run your custom task
     APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phx.digest $SILENCE
     APP='$APP' MIX_ENV='$TARGET_MIX_ENV' $MIX_CMD phx.digest.clean $SILENCE
   "
 }

Marked As Solved

unsek

unsek

I ended up ditching edeliver and just opted for Ansible. But if I’m not mistaken it’s because of actions/checkout@v2 shallow copying the branch or something along those lines so adding this might fix it for you too.

- uses: actions/checkout@v2
- run: |
    git fetch --prune --unshallow

Also Liked

knvjun

knvjun

I got the same problem with edeliver on Github Actions. I tried this solution. It works for me! Thanks!

Where Next?

Popular in Questions Top

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> somethi...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New

Other popular topics Top

AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31307 143
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement