Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting specific files to archive requires additional steps #28

Open
cyberf1y opened this issue Oct 15, 2022 · 3 comments
Open

Selecting specific files to archive requires additional steps #28

cyberf1y opened this issue Oct 15, 2022 · 3 comments
Labels
enhancement New feature or request inclusion/exclusion Related to file inclusion/exclusion and symlinks

Comments

@cyberf1y
Copy link

cyberf1y commented Oct 15, 2022

I want to archive a specific subset of the files in my repository.
Currenty, I must use the following steps, to achieve this:

steps:
  - name: Create a site directory
    run: |
      shopt -s globstar &&
      tar -cvf site.tar **/*.html &&
      mkdir site &&
      tar -xf site.tar --directory site
      
  - name: Upload artifact
    uses: actions/upload-pages-artifact@v1
    with:
      path: 'site'

This, apart from being error-prone, is not efficient, because of the unnecessary calls to tar.

I think, that this could be achieved with the following:

steps:
  - name: Upload artifact
    uses: actions/upload-pages-artifact@v1
    with:
     path: '**/*.html'

with very little changes to action.yml.

@yoannchaudet
Copy link
Contributor

You don't need to use tar in your first step. A simple cp would do.

It has been asked a few times and there never seems to be a compelling reason to complexify the Actions. It is a good practice to assemble all the static assets you need to deploy in a dedicated folder prior to the deployment. All static site generators function this way. If you deploy static files directly, having a step to assemble a site folder is a very good practice.

There are just too many files you would want not just to include but also exclude if we were to allow it in actions/upload-pages-artifact to which point it really does not make any sense anymore and is more error prone than anything else.

@cyberf1y
Copy link
Author

Thanks, I replaced the tar with cp --parents, and now the workflow is indeed a bit simpler.

But anyway, since upload-pages-artifact is doing the taring, and tar supports specifying/excluding files, I thought that adding the option to the action would simplify the workflow of some users, without affecting the currently working one (by keeping includes.path as it is, and setting the includes.files: "." by default).

And if there are too many files to include, I guess the user should switch to a more sophisticated framework/generator, which does the packing "automatically".

@JamesMGreene JamesMGreene added inclusion/exclusion Related to file inclusion/exclusion and symlinks enhancement New feature or request labels Mar 24, 2023
@zumbiepig
Copy link

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request inclusion/exclusion Related to file inclusion/exclusion and symlinks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants