Github release a specific folder
Asked Answered
C

5

21

I have a repository that has a bunch of folders, but I want to create releases for just one of those folders.

Simpler story, it's for a gaming server, and I just want to create releases for the client, as the way of offering downloads of the client to players.

Collateral answered 27/8, 2017 at 16:47 Comment(6)
By "release" do you mean "tag"?Fairbanks
If they can be released separately, they should be separate repositories. Pull them together ideally using a package management tool. Or there's options to have a repository made of other repositories.Dentilingual
By release, have a zipped file to be made available but of only a specific folder within the repository. Perhaps showing the details will help. github.com/crosenblum/kalbase Is my main repository. But I want to create zipped file release of changes to this folder. github.com/crosenblum/kalbase/tree/master/clientCollateral
very good question @Collateral , did you ever find a way of releasing from a folder? we have a master repo with many folder, each folder representing different databases, eveyr database has its own version, any thoughts?Anabiosis
@dim_user not sure if it's still useful 2+ years later, but I just detailed below how to customize your release contents.Capriccio
Releases only save the commit number. You have to upload your own builds. softwareengineering.stackexchange.com/q/366771/390838Gardening
C
5

When a release is published, the automatically generated Source Code .zip and .tar.gz files include all files in the branch you choose here: Selecting git branch for release
(source: github.com)

Therefore, I answered the OP's question this way:

1. Use a branch containing only the release contents

  1. Create a new branch with the contents of your current branch and check it out (e.g. git checkout -b rel)
  2. Delete all non-release files and folders (don't worry, you're only deleting them from the new branch, confirm you are on the right one using git branch)
  3. Move release folder contents to the root folder and delete the empty folder
  4. Stage and commit all changes (e.g. git add . + git commit -a -m "v1 release"
  5. (optional: do not do this if you prefer using the Github interface for writing the release details) Create a release version tag (e.g. `git tag v1.0.0 -m "initial release")
  6. Push this new branch (e.g. git push --set-upstream origin rel)

2. Add an executable/installer to the release

  1. Browse and log into your account and head to https://github.com/USER-NAME/PROJECT-NAME/releases
  2. Click the button for a new release and fill in the release details, choosing the branch you created above
  3. Since GitHub limits uploads of files larger than 50MB (unless you use Git LFS), your runnables (e.g. .exe or .apk) can be added and uploaded into the release itself before publishing it via drag-and-drop:

Dragging files to release

The release will be automatically saved as draft and, only upon publishing, the Source Code archive files will be generated (without the runnables you added above).

P.S.: Images and steps for creating and editing a release available on Managing Releases Gihub Docs page.

Capriccio answered 20/10, 2020 at 13:58 Comment(0)
S
1

If the client/ folder content can be re-built from the rest of the project, ideally, it should not be versioned.

Versioned or not, you can build your release artifact (here, a zip of the client/ folder) and publish it to your repo as a GitHub release.
See "Creating Releases".

It supposes you make a tag first on your repo, in order to associate that zip file to a precise version of said repo.

Sthenic answered 28/8, 2017 at 5:30 Comment(6)
How do I do that, most of what you said, sounds very unclear to me. can you say it plainer, what actual steps I need to take?Collateral
@Collateral what steps are unclear in help.github.com/articles/creating-releases?Sthenic
There references to branches, tags, etc.Collateral
@Collateral Exactly: a release is associated to a tag: create a tag referencing the content of the repo which matches the release you are producing from said content, and upload your release associated to that tag.Sthenic
Downvoted, as this doesn't answer the question (although TBF github may have changed their releases feature since this answer): The link to github's "creating releases" page only describes how to create a release of the project including all its source code, with additional uploaded files... not how to exclude the source.zip (created by default by github) and instead include a .zip with different (subfolder) contents, which is what the OP needs.Sultana
@Collateral not sure if it's still useful 3+ years later, but I just detailed the steps on how to customize your release contents.Capriccio
B
1

Github official document on Releases

VonC shared link

=> As VonC shared the link: from it we glean that to include only one file in your release; you must make a new branch with that specific file_

=> Mention new branch in the release's Target field_

Baeza answered 30/1, 2023 at 19:36 Comment(1)
Good illustration. Upvoted. Although I was downvoted for not answering the OP.Sthenic
A
0

To release a given folder that is in a given repository (assumes Windows OS, step 7 may vary otherwise), you can use this procedure:

  1. Go to the Releases page for the repository (e.g., https://github.com/<organization>/<repository>/releases).

  2. Click the button to create a new release.

  3. In the “Choose a tag” drop-down, enter a version number in this format: v1.2.3 (it may be helpful to read about semantic versioning using the link on the right of the page).

  4. Select the version number you just created (i.e., ensure it appears as selected in the drop-down).

  5. Release title is optional, skip over it or enter something brief and meaningful.

  6. In the “Describe this release” field, add the install steps and any other info that would be relevant to the consumer(s) of your release.

  7. Create a ZIP of your release package as follows (zipping is necessary because folder uploads are not possible, only files):

    a. Create your package locally by organizing the source files into folders the way they would be copied to the target device. For example, if the target app has a bin folder and you’re just deploying bin\foo.dll and want to retain this folder structure on the target, create a local (temporary) bin folder that includes only that DLL. This folder will ultimately become your package. Do not include files/folders that should not be copied to the target.

    b. Right-click the folder(s) you created (bin in the example above) and select “Send to” > “Compressed (zipped) folder”.

    c. Give it a suitable name (e.g., MyAppPackage.zip) and attach it to the release via drag & drop.

  8. Click the Publish button to create the release.

Afflict answered 14/6, 2022 at 12:31 Comment(0)
L
0

A release is always of an executable file - for ex. *.exe, *.tar.gz, *.zip, *.apk, etc. - it could be a list of such files but I haven't come across any folder being released. However, you can release all files that are within a folder.

To release your files in that folder, you can use a action like this one: https://github.com/marketplace/actions/upload-files-to-a-github-release. Go to the "Example with file_glob:" section which has a nice example. I've copy-pasted the code snippet here but I highly recommend you to visit the link for a deeper dive.

name: Publish
on:
  push:
    tags:
      - '*'

jobs:
  build:
    name: Publish binaries
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Build
      run: cargo build --release

    - name: Upload binaries to release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: target/release/my/* # the folder which has all the files that you want to release
        tag: ${{ github.ref }}
        overwrite: true
        file_glob: true

Good Luck...

Lithology answered 29/6, 2023 at 8:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.