Github Actions Push Package to Octopus Deploy Fails every time on a file

I am trying to configure a deployment pipeline for a .net core MVC application The build process works fine, however when i try to use the OctopusDeploy push-package-action the Action always fails.

The error is:
" Uploading package, Perle.styles.css…
Error: Error: Error: EISDIR: illegal operation on a directory, read"
But this happens after some 200 files have already been uploaded. I cannot find any information about this and am unsure what is causing the issue. I am not even sure how to go about debugging this since I don’t understand how this error could occur after a large number of files have already been processed.

My yml file is below and is the entirety of the work flow.

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v3
      with:
        dotnet-version: 7.0.x
    - name: Restore dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --no-restore
    - name: Test
      run: dotnet test --no-build --verbosity normal
    - name: Publish
      run: dotnet publish Perle.csproj -c Release -o website
    - name: Upload a Build Artifact
      uses: actions/upload-artifact@v3
      with:
       name: website
       path: website/**
       if-no-files-found: error      

  deploy_staging:
    needs: build
    runs-on: ubuntu-latest
    
    environment:
      name: test
      url: https://xxx.octopus.app/
  
    steps:
    - name: Download a Build Artifact
      uses: actions/download-artifact@v3
      with:
        name: website
        path: website
    - name: Push a package to Octopus Deploy
      uses: OctopusDeploy/push-package-action@v3
      env:
          OCTOPUS_URL: https://xxx.octopus.app/
          OCTOPUS_API_KEY: XXXXXXXX
          OCTOPUS_SPACE: 'Default'
      with:
          packages: |
            website/**

Hey @mfalconi,

Thanks for reaching out and welcome to the Octopus Forums!

Taking a look at your YAML it looks like we may need to put a step between Download a Build Artifact and Push a package to Octopus Deploy. This step will be responsible for packing the website into one file. You’ll likely want to zip up that folder (or the contents, depending on how you want the file structure to look like when you deploy it from Octopus, e.g the zip contains: website/then a lot of files, or just a zip containing the files themselves.)

Once you have that step zipping up the files, you will then change the packages parameter to explicitly point at the zip file that you created.

Here is an example of something similar to what you might end up with:

    - name: Push a package to Octopus Deploy 🐙
      uses: OctopusDeploy/push-package-action@v3
      env:
        OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
        OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }}
        OCTOPUS_SPACE: 'Default'
      with:
        packages: |
          ${{ github.WORKSPACE }}/target/${{ env.PACKAGE_NAME }}.${{ env.PACKAGE_VERSION }}.zip  

I’m not sure what you censored in the API Key section, and if it’s the github secret name you can ignore this part, but if it is the raw API key I did want to mention that we recommend storing the API key in a Github Repository Secret if you can.

Please let me know if that gets you unstuck or if you have any questions about it!

Best,
Jeremy

Hi Jeremy,

Yes I will set up the secrets after, right now I am trying to just get the actual workflow working first. But I do not want the file zipped i want octopus to just deploy the files as they are since this is how we already have the app being server from our IIS server. I just don’t understand why i am getting a read error after so many files have already been successfully uploaded.

Hi,

Understandable on the API Key!

I just don’t understand why i am getting a read error after so many files have already been successfully uploaded. - This step is designed to upload specific packaged files. Octopus expects apps/websites to be contained in a package and also very specific extensions. This goes along with how you will set up your deployment process, as you will only have to select one file to deploy (e.g. website.1.0.0.zip), and it will unzip all of those files into one folder for you on the destination target. Here is some documentation on packaging to expand a bit further: Packaging applications - Octopus Deploy

Octopus will deploy the files as they are when you zip them. So in your scenario, if you zipped all of the files within the website folder into website.1.0.0.zip, when you go to deploy that package, it will unzip all of those files to a folder called website (unless you specify a custom install directory.)

Here is an end to end guide on deploying to IIS and utilizing GitHub Actions (it’s a bit dated versioning wise, but the same principles apply): Deploy an ASP.NET Core application to IIS using Octopus and GitHub Actions - Octopus Deploy

Please let me know if that helps or if you have any questions.

Best,
Jeremy

Hey Jeremy,

Thanks for sharing that I am going through it now, I do have 1 question if you don’t mind. After the octopus push portion of the action runs, would the package then appear in the Library section of the dashboard?

You’re very welcome!

That’s correct, that’s where it will be.

Please let me know if you are able to get to a good state if you get time, or if you have any questions.

Best,
Jeremy

1 Like

Hey Jeremy I was able to get the package upload to work. Thank you for all the guidance it is much appreciated!

2 Likes

You’re very welcome! Thanks for letting me know.

If you run into any other snags in the future we’re here to help. I hope you have a great rest of your week.

Best,
Jeremy

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.