Skip to content

Commit

Permalink
Fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
x0f5c3 committed Apr 9, 2022
1 parent f69d5ac commit 788a9c9
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 22 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/publish-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,25 @@ jobs:
asset_path: target/release/go_version_manager
asset_name: go_version_manager-x86_64-apple-darwin
asset_content_type: application/octet-stream
generate_sums:
needs: [create_release]
name: Generate hashes
runs-on: ubuntu-latest

steps:
- name: gen_hash
uses: MCJack123/ghaction-generate-release-hashes@v1
id: gen_hash
with:
hash-type: sha256
file_name: hashes.txt

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: hashes.txt
asset_name: hashes.txt
# generate_sums:
# needs: [create_release]
# name: Generate hashes
# runs-on: ubuntu-latest
#
# steps:
# - name: gen_hash
# uses: MCJack123/ghaction-generate-release-hashes@v1
# id: gen_hash
# with:
# hash-type: sha256
# file_name: hashes.txt
#
# - name: Upload Release Asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create_release.outputs.upload_url }}
# asset_path: hashes.txt
# asset_name: hashes.txt
28 changes: 28 additions & 0 deletions src/github.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use anyhow::{Context, Result};
use itertools::Itertools;
use manic::Client;
use serde_json::Value;

pub fn get_tags() -> Result<Vec<String>> {
let client = Client::builder().user_agent("rust_api").build()?;
let resp: Value = client
.get("https://api.github.com/repos/golang/go/tags")
.send()?
.json()?;
Ok(resp
.as_array()
.context("Not an array")?
.iter()
.filter_map(|x| {
// println!("{}", x);
x.as_object()
})
.filter_map(|x| x.get("name"))
.filter_map(|x| {
println!("{}", x);
x.as_str()
})
.filter(|x| x.contains("go"))
.map(|x| x.to_string())
.collect_vec())
}
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::consts::FILE_EXT;
use crate::goversion::Downloaded;
use crate::goversion::GoVersions;
use crate::utils::check_and_ask;

use anyhow::Result;

/// Reads output path from command line arguments
Expand Down Expand Up @@ -41,6 +42,7 @@ mod config;
mod consts;
mod decompressor;
mod error;
mod github;
mod goversion;
mod installed;
mod utils;

0 comments on commit 788a9c9

Please sign in to comment.