GithubHelp home page GithubHelp logo

zip-release's Introduction

Zip Release License

GitHub action that can be used to create release archive using zip or tar.

It works on all platforms: Linux, MacOS and Windows.

Usage

An example workflow config:

name: Create Archive
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Archive Release
      uses: thedoctor0/[email protected]
      with:
        type: 'zip'
        filename: 'release.zip'
        exclusions: '*.git* /*node_modules/* .editorconfig'

The generated archive will be placed as specified by directory, path and filename. If you want to attach it to the latest release use another action like ncipollo/release-action:

- name: Upload Release
  uses: ncipollo/[email protected]
  with:
    artifacts: "release.zip"
    token: ${{ secrets.GITHUB_TOKEN }}

Arguments

filename

Default: release.zip

The filename for the generated archive, relative to directory.

If you use type: tar it's recommended to set the filename to a tar.gz (the tarball is always gzip compressed).

directory

Default: .

The working directory where the zip or tar actually runs.

path

Default: .

The path to the files or directory that should be archived, relative to directory.

Path with whitespace is currently not supported because of the limitation of GitHub actions regarding the parameter formatting (no YAML double quoting). A solution based on similar issues will soon be implemented.

type

Default: zip

Either zip or tar or 7z.

Defines if either a ZIP-file is created, or a tar archive (the latter gzipped).

On Windows platform 7zip is used to zip files as zip command is unavailable there.

exclusions

Default: none

List of excluded files or directories.

Please note: this handles slightly differently, depending on if you use type: zip or type: tar.

ZIP requires you to specify wildcards or full filenames.

TAR allows you to specify only the filename, no matter if it's in a subdirectory.

recursive_exclusions

Default: none

Alternative to exclusions that allows you to specify a list of recursive wildcards. Only applies to type: zip on Windows where 7zip is used.

For example:

exclusions: *.txt will only exclude files ending with .txt

recursive_exclusions: *.txt will exclude files ending with .txt in any subdirectory.

custom

Default: none

Provide any custom parameters to the zipping command.

For example:

custom: --ignore-failed-read option used with tar command, which allows to ignore and continue on unreadable files.

command

Default: none

An extra command that will run before zipping.

For example:

command: "mkdir -p release" can be used to create a directory where the archived file can be stored to fix tar issue with file changed as we read it error

zip-release's People

Contributors

amamic1803 avatar holographicwings avatar justanotherdev avatar klaernie avatar rapiz1 avatar readingdancer avatar sagarreddypatil avatar thedoctor0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zip-release's Issues

After v0.5 is not working anymore

Hi, I'm using the master version of tis action and three days ago now it stoped working.
What I get is:

Run thedoctor0/zip-release@master
sh: /home/runner/work/_actions/thedoctor0/zip-release/master/entrypoint.sh: No such file or directory

It really looks like is due to the new version.

fully recursive exclusions?

Hi, am I struggling figuring out the syntax that will allow me to exclude all files of a given type recursively.

For example, let's say I want to exclude all files ending with .txt

exclusions: *.txt <- only excludes files at the root dir
exclusions: */*.txt <- only excludes files at the 2nd level

I have tried some other combos, but I think the actual thing here is to pass the r modifier to the exclusion flag in 7zip.

Glancing at your source code, it looks like you pass -x!

According to the 7zip docs it looks like if that was changed to -xr! it would allow for recursive searching.

tar fails with current directory, reporting "file changed as we read it"

This problem is due to tar command itself. Running and saving file in the current directory will simply reproduce this problem:

$ tar czvf test.tar.gz .  # tar: .: file changed as we read it

Neither --exclude=test.tar.gz nor --ignore-failed-read works.

The only workaround is to save tar file in an excluded dir, like this

$ mkdir -p github-release
$ tar --exclude=github-release -czvf github-release/test.tar.gz .

So as for this action, it could be written like this (if you want to use tar)

name: Create Archive
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Create release folder
      run: mkdir -p github-release

    - uses: actions/checkout@master
    - name: Archive Release
      uses: thedoctor0/[email protected]
      with:
        type: 'tar'
        filename: 'github-release/release.tar.gz'
        exclusions: 'github-release .git'

Help with excluding directory

I have an build directory, which i want to hide. I am archiving a chrome extension into a zip and want to exclude the build directory.
This is my current workflow YAML:

name: CI

on:
  push:
  pull_request:

jobs:
 build:
    runs-on: windows-latest
    steps:
     - uses: actions/checkout@v2
     - name: Create report file
       run: date +%s > report.txt
       
     - name: Delete old Archive
       run: del "D:\a\Sidebar\Sidebar\Build\Sidebar_latest.zip"
       shell: cmd
    
     - name: Archive Release
       uses: thedoctor0/zip-release@master
       with:
         type: 'zip'
         filename: 'Sidebar_latest.zip'
         exclusions: '*.git* /*Build/* README.md report.txt'

     - name: Move to "Build" directory
       run: move /y D:\a\Sidebar\Sidebar\Sidebar_latest.zip D:\a\Sidebar\Sidebar\Build\
       shell: cmd
       
     - name: Commit report
       run: |
          git config --global user.name 'Minionguyjpro'
          git config --global user.email '[email protected]'
          git add -A
          git commit -am "Made new build"
          git push

Exclusions not working with specifing a path

I have tried several iterations of exclusions;

*./app
.app/
/app/
./app
/app/

  • name: npm install, build, and test
    working-directory: 'ui/${{env.AZURE_WEBAPP_NAME}}'
    run: |
    npm install
    npm run build --if-present
    #npm run test --if-present

    • name: Zip artifacts
      uses: TheDoctor0/[email protected]
      with:
      type: 'zip'
      path: ./ui/${{env.AZURE_WEBAPP_NAME}}/*
      filename: ${{ env.BRANCH_NAME}}.zip
      exclusions: '*.app *.cert /node_modules/ *.test'

env:
AZURE_WEBAPP_NAME: glypheditor
AZURE_WEBAPP_PACKAGE_PATH: /ui
NODE_VERSION: 18.x
BRANCH_NAME: develop
BUILD_CONFIGURATION: Debug
VERSION_SUFFIX: develop
SLOT: staging
INPUT_FILENAME: develop.zip
INPUT_PATH: ./ui/glypheditor/*
INPUT_DIRECTORY: .
INPUT_EXCLUSIONS:
INPUT_RECURSIVE_EXCLUSIONS:
INPUT_CUSTOM:
INPUT_TYPE: zip

Error Name not matched multiple paths with 0.7.5

suddenly getting the following error although the folders / files exist:
"zip warning: name not matched: dist node_modules package.json"

Using the latest 0.7.5

Here's the workflow:
- name: Zip the folder
uses: thedoctor0/zip-release@main
with:
type: 'zip'
filename: 'release.zip'
directory: '.'
path: 'dist node_modules package.json'

After switching to thedoctor0/[email protected] it works again

Have the extension be added automatically based on the type.

Right now, I have this YAML, which requires me to define both the archive_type and the archive_extension:

    strategy:
      matrix:
        os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, windows-latest, macos-latest]
        include:
          - os: ubuntu-22.04
            outputsuffix: ubuntu-2204
            archive_type: tar
            archive_extension: tar.gz
          - os: ubuntu-20.04
            outputsuffix: ubuntu-2004
            archive_type: tar
            archive_extension: tar.gz
          - os: ubuntu-18.04
            outputsuffix: ubuntu-1804
            archive_type: tar
            archive_extension: tar.gz
          - os: macos-latest
            outputsuffix: mac
            archive_type: tar
            archive_extension: tar.gz
          - os: windows-latest
            outputsuffix: win
            archive_type: zip
            archive_extension: zip


    - name: Archive Release
      uses: thedoctor0/[email protected]
      with:
        type: ${{matrix.archive_type}}
        filename: ${{github.workspace}}/build/lens_reproject_x64-avx2_${{matrix.outputsuffix}}.${{matrix.archive_extension}}
        directory: ${{github.workspace}}/build

Which is arguably a little cumbersome. Alternatively, you could also support "tar.gz" as a type instead of "tar". This way, we can reuse the variable.

Feature Request: Configurable Hash Computation of Generated ZIP File

Hello,

I'm a user of the zip-release project and find it incredibly useful. However, I've identified a feature that could significantly enhance the utility and flexibility of the tool โ€“ the option to compute a configurable hash of the generated ZIP file.

This feature would be particularly beneficial when publishing software through package managers like Homebrew, which require an SHA-256 hash of the software artifact for integrity verification. It would also be useful for users who prefer or need to use other hash functions like MD5 for their particular use cases.

The proposed feature would add a new configuration option hash that could be set to the desired hash function (e.g., sha256, md5). After the ZIP file is created, the specified hash is computed and made available as an output of the job.

For example:

# ... 
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Create ZIP Release
      id: zip-release
      uses: TheDoctor0/zip-release@master
      with:
        filename: "my_project.zip"
        hash: "sha256"
        
    - name: Update Homebrew Formula
      uses: some-homebrew-action@v1
      with:
        formula: "my_project"
        url: ${{ steps.zip-release.outputs.download_url }}
        sha256: ${{ steps.zip-release.outputs.hash }}

In this example, steps.zip-release.outputs.hash would hold the computed hash of the created ZIP file, and the hash input allows the user to specify the hash function to be used.

This feature would offer greater flexibility for users, allowing them to choose the hash function that best fits their needs. Additionally, it would allow for more seamless integration with package managers and provide stronger assurance of file integrity.

Looking forward to your thoughts on this proposal!

Best,
Tushar.

Unexpected inputs as well as undefined tag & input

Hello, i want to build & release a application but i am using the args defined in Github Actions page but still getting an error.

Warning: Unexpected input(s) 'type', 'directory', 'filename', valid inputs are ['allowUpdates', 'artifactErrorsFailBuild', 'artifact', 'artifacts', 'artifactContentType', 'body', 'bodyFile', 'commit', 'discussionCategory', 'draft', 'generateReleaseNotes', 'makeLatest', 'name', 'omitBody', 'omitBodyDuringUpdate', 'omitDraftDuringUpdate', 'omitName', 'omitNameDuringUpdate', 'omitPrereleaseDuringUpdate', 'owner', 'prerelease', 'removeArtifacts', 'replacesArtifacts', 'repo', 'skipIfReleaseExists', 'tag', 'token', 'updateOnlyUnreleased']
Run ncipollo/[email protected]
Error: Error undefined: No tag found in ref or input!
name: Build & release

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [16.x]

    steps:
      - uses: actions/checkout@v3
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm install
      - run: npm run build --if-present
      - run: ls out/
      - name: Upload build as release
        uses: ncipollo/[email protected]
        with:
          type: 'zip'
          directory: 'out'
          filename: 'build.zip'
          artifacts: 'build.zip'
          token: ${{ secrets.GITHUB_TOKEN }}

On Windows, got error INPUT_CUSTOM: unbound variable

Got error on Windows: bash.EXE and unbound variable

  • just got since commit: 7a1d901
  • action: thedoctor0/zip-release@main
  • version: main

Error:

๐Ÿ“ฆ Creating zip archive...
D:\a\_actions\thedoctor0\zip-release\main/entrypoint.sh: line 19: INPUT_CUSTOM: unbound variable
Error: Process completed with exit code 1.

Workaround

Add empty variable INPUT_CUSTOM on step or action

- name: Archive Release
  uses: thedoctor0/zip-release@main
  with:
    type: 'zip'
    filename: 'release.zip'
    exclusions: '*.git* /*node_modules/* .editorconfig'
  env:
    INPUT_CUSTOM: ""

Space in file name / path / directory fails action

If you put a space in file name, path, or directory, this action fails. This is because when it gets passed to zip command, if there is a space in path/directory/filename, it gets interpreted as more than one argument which leads to failure. If any of these include spaces, they should be put inside double quotes before passing to zip command.
For example:
path: boards/3D Pinball for Windows - Space Cadet/.
fails because there are spaces in folder name.

Using path as base directory for files inside the zip file

When using

        uses: thedoctor0/zip-release@main
        with:
          type: 'tar'
          path: 'publish/linux64/'
          exclusions: '*.pdb'
          filename: 'linux-x64.tar.gz'

i get a tar file with my files in the folders
linux-x64.tar.gz\publish\linux64\

but it would be way nicer if they would be in the root of the zip file
linux-x64.tar.gz\

Broken pipeline on update to v0.7.0, `INPUT_CUSTOM: unbound variable`

Evening,

An error I encountered today on update from 0.6.2 to 0.7.

I'm running runner version '2.300.0'
and

Operating System
  Distribution: Amazon Linux
  Architecture: x86_64

The job step was fairly vanilla

    - name: Compress win10-x64 Build
      uses: thedoctor0/[email protected]
      with:
        type: 'zip'
        path: src/myProject/bin/Release/net7.0/win10-x64/publish
        filename: 'Release_win10-x64.zip'
        exclusions: '*.git* /*node_modules/* .editorconfig'

The failing log entry was

Run thedoctor0/[email protected]
  with:
    type: zip
    path: src/myProject/bin/Release/net7.0/win10-x64/publish
    filename: Release_win10-x64.zip
    exclusions: *.git* /*node_modules/* .editorconfig
    directory: .
  env:
    DOTNET_ROOT: /usr/share/dotnet
Run $GITHUB_ACTION_PATH/entrypoint.sh
  $GITHUB_ACTION_PATH/entrypoint.sh
  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    DOTNET_ROOT: /usr/share/dotnet
    INPUT_FILENAME: Release_win10-x64.zip
    INPUT_PATH: src/myProject/bin/Release/net7.0/win10-x64/publish
    INPUT_DIRECTORY: .
    INPUT_EXCLUSIONS: *.git* /*node_modules/* .editorconfig
    INPUT_RECURSIVE_EXCLUSIONS: 
    INPUT_TYPE: zip

๐Ÿ“ฆ Creating zip archive...
/opt/actions-runner/_work/_actions/thedoctor0/zip-release/0.7.0/entrypoint.sh: line 42 INPUT_CUSTOM: unbound variable
Error: Process completed with exit code 1.

I have not dabbled with actions, but by convention I see that unlike the other inputs, CUSTOM_INPUT isn't defined at

zip-release/action.yml

Lines 40 to 47 in d81722b

env:
INPUT_FILENAME: ${{ inputs.filename }}
INPUT_PATH: ${{ inputs.path }}
INPUT_DIRECTORY: ${{ inputs.directory }}
INPUT_EXCLUSIONS: ${{ inputs.exclusions }}
INPUT_RECURSIVE_EXCLUSIONS: ${{ inputs.recursive_exclusions }}
INPUT_CUSTOM: ${{ inputs.custom }}
INPUT_TYPE: ${{ inputs.type }}

Many thanks!

tar only allows for one exclusion

For the zip archive type entrypoint.sh iterates over $INPUT_EXCLUSIONS to add a -x! argument per 'word'.

But for the tar archive type it's just doing:

tar -zcvf $INPUT_FILENAME --exclude=$INPUT_EXCLUSIONS $INPUT_PATH 

which means that every word after the first in INPUT_EXCLUSIONS instead is treated by tar as an input path, the exact opposite of what is wanted.

And if you use this with directory: '..' as I'm doing then you get errors like:

tar: .editorconfig: Cannot stat: No such file or directory

because tar can't find the cited filenames/globs in order to use them as input files.

So, the same looping as is done for zip needs to be implemented for tar. For now I'm just going to use a manual script: | for my use case.

Exclusions from distignore

๐Ÿ‘‹ I searched the bash script and I don't believe this can be done, but is it possible to list the exclusions from a .distignore file versus inlining them in the action?

#.distignore
/.wordpress-org
/.git
/.github
/node_modules
/src
/vendor
/webpack
.browserlistrc
.distignore
.editorconfig
... etc

entrypoint.sh: 'unexpected operator' from 0.4.0 updates

After my build updated to 0.4.0 (probably should have pinned the version in hindsight ๐Ÿ˜„ ), my existing Action started failing silently during build.

From what I can tell, this is from the addition of the [ "$5" == "zip" ] and [ "$5" == "tar" ] operators, which sh doesn't support.

If you want to see an example, this action results in this log with the following error:

๐Ÿ“ฆ Creating zip archive...


โœ” Successfully created zip archive.

/entrypoint.sh: 14: [: zip: unexpected operator
/entrypoint.sh: 25: [: zip: unexpected operator

If you need any more info, just let me know ๐Ÿ‘

Exclude folder

I'm trying to exclude a folder and already tried
fullpath/exclude/*
/fullpath/exclude/*
/fullpath/exclude/*
and much more, but nothing worked.
What is the right Syntax for this?

name: Create Archive Light on: [push] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: pull latest and remove old file from repo run: | git config --global user.name "1Timo1" git config pull.rebase false git pull rm -f BingoRPGomme.zip - name: Archive Release uses: thedoctor0/zip-release@master with: filename: 'BingoRPGommeLight.zip' exclusions: '/assets/minecraft/textures/gui/\* *.git* /*node_modules/* .editorconfig *.zip' - name: push changes to remote run: | git add -A git commit -m "new pack" git push --force

Inclusions?

Is there a way to only include a single file type to zip (the opposite of exclude)?
I have a lot of .nupkg files and adding them one by one is not a good idea.

Exclusion format

What exactly is the exclusion format for files and folders?

I want to exclude
.git/
.github/
.gitignore

How should I add them to the exclusion list?

Folders starting with a `.` are not excluded from zip

Hi and thank you for this cool action.

Below is my exclusions argument. Both .git and .github are folders and they aren't excluded when the zip is created. The rest are files and they are excluded.

exclusions: composer.json composer.lock .editorconfig .git .github .gitignore .phpcs.xml.dist phpstan.neon.dist

Upload Release fails

Hello,

Thank you for the great action. It was working great but now there is an error with the Upload Release step.

Run ncipollo/release-action@v1
...
Error: Error 404: Not Found

Best,
Atanas

Symlinking by default would be nice.

I'd suggest adding a keep_symlinks option. The zip command needs an additional --symlinks to avoid copying the file pointed to, instead of just archiving the symlink.

Tar does this by default.

This behavior makes sense when you are packaging stuff for release (so I'd even consider making this default to True).

unzip file

Hi
Can this action be used to unzip a file? Thanks

Invalid command arguments (option 'x' (exclude files matching patterns) requires a value)

Hello!

I try to use your action but get this error... any help?

Thanks advance!

Ben

/usr/bin/docker run --name af96b46131acb37b7049b4b3740bfe304960bf_be44db --label af96b4 --workdir /github/workspace --rm -e INPUT_FILENAME -e INPUT_PATH -e INPUT_EXCLUSIONS -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/**********/**********":"/github/workspace" af96b0:6131acb37b7049b4b3740bfe304960b1  "extension.zip" "dist" ""

๐Ÿ“ฆ Creating zip archive...


zip error: Invalid command arguments (option 'x' (exclude files matching patterns) requires a value)

โ›” Unable to create zip archive.

##[error]Docker run failed with exit code 1

problem generating zip from different branches for release

I'm trying to create a zip file for each branch I have to make a new release,
my code

name: create archive
on:
  push:
    paths:
      - '**.txt'
jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v2

      - name: Get next version
        uses: reecetech/[email protected]
        id: version
        with:
          scheme: semver
          increment: patch

      - name: Archive 1.19.3 Branch Release
        uses: thedoctor0/[email protected]
        with:
          type: 'zip'
          filename: 'Dark_Everywhere_1.19.3.zip'
          exclusions: '*.git* /*node_modules/* .editorconfig *.md pack_hd.png'

      - name: Archive 1.19 Branch Release
        uses: actions/checkout@v2
        with:
          ref: '1.19'

      - name: Zip 1.19 Branch
        uses: thedoctor0/[email protected]
        with:
          type: 'zip'
          filename: 'Dark_Everywhere_1.19.zip'
          exclusions: '*.git* /*node_modules/* .editorconfig *.md pack_hd.png'

      - name: Archive 1.18 Branch Release
        uses: actions/checkout@v2
        with:
          ref: '1.18'

      - name: Zip 1.18 Branch
        uses: thedoctor0/[email protected]
        with:
          type: 'zip'
          filename: 'Dark_Everywhere_1.18.zip'
          exclusions: '*.git* /*node_modules/* .editorconfig *.md pack_hd.png'

      - name: Upload Release
        uses: ncipollo/release-action@v1
        with:
          tag: "${{ steps.version.outputs.version }}"
          name: "Dark Everywhere ${{ steps.version.outputs.version }}๐ŸŒ™"
          artifacts: "*.zip"
          token: ${{ secrets.GITHUB_TOKEN }}

the problem is that every time the new release is released only the last zip file is kept

Dark_Everywhere_1.18.zip

but he was supposed to go up to 3
I tried using the dependency

ncipollo/release-action@v1
and the
marvinpinto/action-automatic-releases@latest

but both give the same problem, which made me come to the conclusion that the problem may be that each zip that is generated is being subscribed on top of the other, then when the release is posted there is only the last file that was subscribed, you know how can i solve this problem?

latest release broke zipping assets in our pipeline

hello, I'm not exactly sure why, but the latest release broke zipping of our assets. the error was simply that there is "nothing to do", so I'm guessing it's related to the way we're specifying what to zip using asterisk notation, but I'm not entirely sure. happy to provide more info to help debug if you can point me to what would help. hopefully this was unintentional. one thing that might be useful to know is that we are using lerna to manage this repository.

here's a screenshot of the failing pipeline:

image

we fixed it by specifying thedoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 instead of @master

Zip file location

Where is the created archive stored? Is there any possibility to attach it as an asset to a release?

This action can't auto upload to Artifact

This action can't auto upload to Artifact. We can use Upload-Artifact to upload the zip. But it is not convenient. Hope author can add this feature.
My code:

name: Create Archive
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Archive Release
      uses: TheDoctor0/[email protected]
      with:
        filename: 'release.zip'
        exclusions: '*.git* /*node_modules/* .editorconfig'
        type: 'zip'
    - uses: actions/upload-artifact@v2
      with:
        name: my-artifact
        path: ./release.zip

File changed as we read it tar issue

Hi @TheDoctor0,

Greetings.

I am getting an error when trying to compress a directory using the type tar. It seems when building the file it includes the file.tar.gz file during the process (that is being created in the same directory).

Run thedoctor0/[email protected]
Run $GITHUB_ACTION_PATH/entrypoint.sh

๐Ÿ“ฆ Creating tar archive...
./
./mymodule
./README.md
tar: .: file changed as we read it

โ›” Unable to create tar archive.
Error: Process completed with exit code [1]...

Parameters

- name: Archive Release tar
  uses: thedoctor0/[email protected]
  with:
    type: "tar"
    filename: "${{ github.event.repository.name }}-mypkg-v${{ needs.versioning.outputs.sem_version }}.tar.gz"
    directory: src/mymodule
    exclusions: "${{ github.event.repository.name }}-mypkg-v${{ needs.versioning.outputs.sem_version }}.tar.gz"

Related post

Excluding a folder, all its files and subfolders

I'm having a bit of bother trying to exclude a folder (in my example called "folder")

in my repo TheFlyingBadger/test i've got an exclusion of

      - name: Zip Release
        uses: TheDoctor0/[email protected]
        with:
                filename: ${{ needs.checktag.outputs.zipname }}
                exclusions: '*.git* ./folder*'

Action

but, even with various combos of slashes and asters, i'm still getting variously the empty folder (which isn't the end of the world) or the folder with it's dummy files in.

pointers for my stupidity?

Zipping nested folders

Hello! After executing the actions below

      - name: Zip merged_native_libs folder
        uses: thedoctor0/[email protected]
        with:
          type: 'zip'
          directory: 'build/app/intermediates/merged_native_libs/prodRelease/out/lib/'
          filename: 'merged_native_libs.zip'

      - name: Upload merged_native_libs to artifacts
        uses: actions/upload-artifact@v3
        with:
          name: merged_native_libs
          path: build/app/intermediates/merged_native_libs/prodRelease/out/lib/merged_native_libs.zip

I get the zipped folder with the following structure:

.
โ””โ”€โ”€ build/
    โ””โ”€โ”€ app/
        โ””โ”€โ”€ intermediates/
            โ””โ”€โ”€ merged_native_libs/
                โ””โ”€โ”€ prodRelease/
                    โ””โ”€โ”€ out/
                        โ””โ”€โ”€ lib/
                            โ””โ”€โ”€ <desired folders>

How can I get a zip with only <desired folders>?

Windows environment

This action does not seem to work in a Windows environment:

sh: D:a_actionsthedoctor0zip-releasemaster/entrypoint.sh: No such file or directory

https://github.com/marceltaeumel/opensmalltalk-vm/runs/3136118562?check_suite_focus=true

      - name: Pack VM
        uses: thedoctor0/zip-release@master
        with:
          path: 'products/vm'
          filename: 'products/${{ env.IDENTIFIER }}_${{ env.REVISION }}.zip'
          exclusions: '*.def *.exp *.lib *.map *.o *.res *Unstripped* *.ignore'

https://github.com/marceltaeumel/opensmalltalk-vm/runs/3135986712?check_suite_focus=true

      - name: Pack VM
        uses: thedoctor0/zip-release@master
        with:
          directory: '${{ env.PRODUCTS_PATH }}/vm'
          filename: '${{ env.PRODUCTS_PATH }}/${{ env.IDENTIFIER }}_${{ env.REVISION }}.zip'
          exclusions: '*.def *.exp *.lib *.map *.o *.res *Unstripped* *.ignore'

Support on Windows?

Build on Windows gives me this error:

Error: Container action is only supported on Linux

Any intention to support Windows? I cannot use ubuntu as my repo contains projects that must be built using UWP.

how to get tar or tar.gz compressed files for linux environment

I could get zip generated by using the following in .yml:

      - name: Zip Release
        ## You may pin to the exact commit or the version.
        # uses: TheDoctor0/zip-release@a1afcab9c664c9976ac398fa831eac67bed1eb0e
        uses: TheDoctor0/[email protected]
        with:
          # Filename for archive
          filename: MyApp.zip
          # Base path for archive files
          path: ./package/
          # Working directory before zipping
          directory: .
          # List of excluded files / directories
          #exclusions: .
          # Tool to use for archiving
          type: zip

What all should I tweak for tar or tar.gz? If you have any example on tar side, please share it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.