Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 0481ae6
Author: Cameron Cooper <[email protected]>
Date:   Tue Sep 24 15:01:33 2024 -0500

    tag and release on push to main

commit 7cfe6cf
Author: Cameron Cooper <[email protected]>
Date:   Tue Sep 24 14:53:20 2024 -0500

    fix build tagging

commit dcbe259
Author: Cameron Cooper <[email protected]>
Date:   Tue Sep 24 14:50:37 2024 -0500

    fix build tagging

commit a833296
Author: cameroncooper <[email protected]>
Date:   Tue Sep 24 14:43:36 2024 -0500

    added get_aggsig_additional_data command (#5)

    * added get_aggsig_additional_data command
  • Loading branch information
cameroncooper committed Sep 24, 2024
1 parent a1da8d4 commit 05944f9
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 11 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build Pull Request

on:
pull_request:

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
environment: goreleaser
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run GoReleaser (Build)
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: ~> v1
args: build --clean --skip=validate
78 changes: 67 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,72 @@
name: goreleaser
name: Release

on:
pull_request:
push:
tags:
- "*"

permissions:
contents: write
branches:
- main

jobs:
goreleaser:
tag:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get latest tag
id: get_latest_tag
run: |
# Fetch all tags from the remote
git fetch --tags
# Get the latest tag from git
latest_tag=$(git describe --tags --abbrev=0 --match "v*")
echo "Latest tag: $latest_tag"
# If there are no tags, start from v0.0.0
if [ -z "$latest_tag" ]; then
echo "v0.0.0" > latest_tag.txt
else
echo "$latest_tag" > latest_tag.txt
fi
- name: Increment version
id: increment_version
run: |
latest_tag=$(cat latest_tag.txt)
# Remove the 'v' from the version to work with the numbers
version_without_v=${latest_tag#v}
# Split the tag into major, minor, and patch versions
IFS='.' read -r -a version_parts <<< "$version_without_v"
major=${version_parts[0]}
minor=${version_parts[1]}
patch=${version_parts[2]}
# Increment the patch version
new_patch=$((patch + 1))
new_version="v$major.$minor.$new_patch"
echo "New version: $new_version"
# Save the new version to the GitHub environment to be used in future steps
echo "new_version=$new_version" >> $GITHUB_ENV
- name: Create and push new tag
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
run: |
new_version=${{ env.new_version }}
# Create a new tag
git tag "$new_version"
# Push the new tag to the remote repository
git push origin "$new_version"
release:
needs: tag
runs-on: ubuntu-latest
environment: goreleaser
steps:
Expand All @@ -19,14 +75,14 @@ jobs:
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: stable
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
version: ~> v1
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions internal/cmd/coinset/get_aggsig_additional_data.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/spf13/cobra"
)

func init() {
rootCmd.AddCommand(getAggsigAdditionalDataCmd)
}

var getAggsigAdditionalDataCmd = &cobra.Command{
Use: "get_aggsig_additional_data",
Short: "Returns the AGG_SIG additional data",
Long: `Returns the additional data used for AGG_SIG conditions for the current network`,
Run: func(cmd *cobra.Command, args []string) {
makeRequest("get_aggsig_additional_data", nil)
},
}

0 comments on commit 05944f9

Please sign in to comment.