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

Upload new snap for v1.1.5 #134

Open
mitchdz opened this issue Aug 14, 2023 · 5 comments
Open

Upload new snap for v1.1.5 #134

mitchdz opened this issue Aug 14, 2023 · 5 comments

Comments

@mitchdz
Copy link
Contributor

mitchdz commented Aug 14, 2023

Thanks for merging the snapcraft update! (#132)

Could the latest version be uploaded to snapcraft?

@aksakalli
Copy link
Owner

thanks for contributing. Do I need to create a release or do I need to manually trigger a build?

@mitchdz
Copy link
Contributor Author

mitchdz commented Aug 14, 2023

You'd need to manually trigger a build. You can change the release tag manually in snap/snapcraft.yaml like so:

diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index be8c5f2..dd81d97 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -2,7 +2,7 @@ name: gtop
 summary: System monitoring dashboard for terminal
 description: |
   System monitoring dashboard for terminal
-version: git
+version: 1.1.5
 base: core22
 grade: stable

And after running snapcraft you should see gtop_1.1.5_amd64.snap. You can follow https://snapcraft.io/docs/releasing-your-app to upload the snap.

On a side-note, this is a little error prone because it assumes you set the right version manually which is a little tedious (in my opinion). An alternative is we can set snapcraft to pull the git source at a specific tag and build that. I personally prefer this because it also means you can't build a dirty source.

If you'd prefer the version control that I just mentioned above, I can make a PR for that, the diff is pretty simple:

diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index be8c5f2..dd81d97 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -2,7 +2,7 @@ name: gtop
 summary: System monitoring dashboard for terminal
 description: |
   System monitoring dashboard for terminal
-version: git
+version: 1.1.5
 base: core22
 grade: stable
 
@@ -14,7 +14,9 @@ apps:
 
 parts:
   gtop:
-    source: .
+    source: https://github.com/aksakalli/gtop
+    source-type: git
+    source-tag: v1.1.5
     plugin: npm
     npm-include-node: true
     npm-node-version: "17.3.0"

This of course means that when you create a new release tag and want to publish the snap, the version and source-tag should be updated for the build.

@aksakalli
Copy link
Owner

Is there a way to automate this with Github Actions or something, if not please feel free to send a PR.

If the version is set as version: git, is it building the latest HEAD? So I need to add this tag change after creating a release?

@mitchdz
Copy link
Contributor Author

mitchdz commented Aug 14, 2023

I honestly haven't messed around with github actions too much, but I would imagine it could be done. I would say it depends how often you plan on updating package to see if it's worth setting that up.

The version: git string is an attribute that allows snapcraft to extract the version using git describe. For example, if you built HEAD without any changes right now it would be gtop_0+git.0406441_amd64.snap which just doesn't look great. It's pretty common to hardcode the version and upload the snap whenever you're ready manually.

@mitchdz
Copy link
Contributor Author

mitchdz commented Aug 14, 2023

PR to pin 1.1.5 - #135

Also found a handy variable during the snap build ${SNAPCRAFT_PROJECT_VERSION} which is the value of version: X so to change the build, you only need to change a single value 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants