casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
18.08k stars 409 forks source link

Add support for Snap #1231

Closed akshaybabloo closed 1 year ago

akshaybabloo commented 1 year ago

This partially fixes #429 by adding support for Snap.

Now you will have to create a Ubuntu account and then install Snapcraft from your terminal

  1. sudo snap install snapcraft --classic => this should also install multipass or else it will ask for you to install
  2. snapcraft login
  3. snapcraft export-login file.txt - you might have to enter your username and password again
  4. Create a GitHub secrets with SNAPCRAFT_LOGIN as your key and the values from the file.

You might probably want to try this on your local system. I think this should do it.

akshaybabloo commented 1 year ago

@casey can I add a new release CI - .github/workflows/snap-release.yaml to upload the builds?

casey commented 1 year ago

@akshaybabloo Yup definitely. You could also add it to the existing release YAML file.

Is there a good way to automatically update the version numbers? It would be nice if I didn't have to update the yaml files when cutting a new release.

akshaybabloo commented 1 year ago

Is there a good way to automatically update the version numbers? It would be nice if I didn't have to update the yaml files when cutting a new release.

Working on it. I will add a shell script to update that.

casey commented 1 year ago

Working on it. I will add a shell script to update that.

This can be left for another diff, just to keep things simple.

Also, does the snapcraft.yaml file need to be in a snap subdirectory? If not, then let's just put it in the root, since it's only one file.

akshaybabloo commented 1 year ago

@casey I think its ready. I tried it locally and it runs fine. I have updated the description, you will hve to create the account and upload it 🤞🏾

casey commented 1 year ago

@casey I think its ready. I tried it locally and it runs fine. I have updated the description, you will hve to create the account and upload it 🤞🏾

Nice! Do you know if I can do this from a mac? I don't have an Ubuntu box handy.

akshaybabloo commented 1 year ago

@casey I think its ready. I tried it locally and it runs fine. I have updated the description, you will hve to create the account and upload it 🤞🏾

Nice! Do you know if I can do this from a mac? I don't have an Ubuntu box handy.

I think you can. https://snapcraft.io/docs/installing-snapcraft. My mac is way too old to handle this 😄

akshaybabloo commented 1 year ago

You will need Docker and Multipass though

casey commented 1 year ago

Can releasing on snap be done on github actions? I don't think I can commit to a manual release step. I make frequent releases, and I've found that I just do a bad job managing packages for OSs that I don't use.

akshaybabloo commented 1 year ago

Can releasing on snap be done on github actions? I don't think I can commit to a manual release step. I make frequent releases, and I've found that I just do a bad job managing packages for OSs that I don't use.

The snap-release.yaml workflow should do that for you. All you must do is change the version number in snapcraft.yaml when releasing a new tag. I can create a python script to automat this if that's OK with you (that is to change the version number of new tag release)?

But for now you will have to create a secret toke for this to work

casey commented 1 year ago

I just tried to publish, and it looks like classic confinement now requires manual review, so that will take a while. Also, did you happen to register the just snap name? I tried to register it, but it looks like it's taken by a private snap.

casey commented 1 year ago

Also, here's a snapcraft.yaml file with some more metadata:

base: core20
confinement: classic
contact: casey@rodarmor.com
description: Just is a handy way to save and run project-specific commands.
grade: stable
icon: icon.png
issues: https://github.com/casey/just/issues
license: CC0-1.0
name: just
source-code: https://github.com/casey/just
summary: Just a command runner
version: '1.2.0'
website: https://just.systems

apps:
  just:
    command: bin/just

parts:
  just:
    source: https://github.com/casey/just
    source-type: git
    source-tag: '1.2.0'
    source-depth: 1
    plugin: rust
akshaybabloo commented 1 year ago

I just tried to publish, and it looks like classic confinement now requires manual review, so that will take a while. Also, did you happen to register the just snap name? I tried to register it, but it looks like it's taken by a private snap.

I didn't actually. Must be someone else. I hope there is another name we can have it just to publish it?

akshaybabloo commented 1 year ago

Also, here's a snapcraft.yaml file with some more metadata:

base: core20
confinement: classic
contact: casey@rodarmor.com
description: Just is a handy way to save and run project-specific commands.
grade: stable
icon: icon.png
issues: https://github.com/casey/just/issues
license: CC0-1.0
name: just
source-code: https://github.com/casey/just
summary: Just a command runner
version: '1.2.0'
website: https://just.systems

apps:
  just:
    command: bin/just

parts:
  just:
    source: https://github.com/casey/just
    source-type: git
    source-tag: '1.2.0'
    source-depth: 1
    plugin: rust

Updated

casey commented 1 year ago

I just submitted a request for the name, and it was approved. I think maybe they have some anti-squatting check for short names, or english words, or something.

casey commented 1 year ago

Can you enable pushes from reviewers for this PR? I'm updating the YAML file and building locally, and it would be convenient to be able to push the changes that I make to the PR branch.

akshaybabloo commented 1 year ago

Can you enable pushes from reviewers for this PR? I'm updating the YAML file and building locally, and it would be convenient to be able to push the changes that I make to the PR branch.

I think it's already enabled.

I just submitted a request for the name, and it was approved. I think maybe they have some anti-squatting check for short names, or english words, or something.

Nice!

casey commented 1 year ago

Are you sure? I tried to push, but it was rejected. You might have branch protection enabled on master.

akshaybabloo commented 1 year ago

All looks good from my side (screenshots below).

image

image

casey commented 1 year ago

Something is completely hosed with git. I'm not sure if it's my local branch, something with how github is configured, or what. I was able to push the wrong commit to your branch (i force pushed master, which auto-closed the PR) but can't push the right branch. I'll push to a new branch and open a new PR.

akshaybabloo commented 1 year ago

Okay. Yep Git does that time-to-time specially submodules