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

Hackage publish #71

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 50 additions & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,53 @@ jobs:
runs-on: ubuntu-22.04
needs: build
steps:
- name: Checkout source code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
name: Download source distribution file artifact
with:
name: source-distribution-file
path: ./artifacts
- uses: actions/download-artifact@v3
name: Download haddock artifact
with:
name: github-pages
path: ./artifacts
- name: Create release draft (GitHub)
env:
MAESTRO_SDK_VERSION: ${{needs.build.outputs.MAESTRO_SDK_VERSION}}
run: |
export GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
SEMANTIC_VERSION=v${MAESTRO_SDK_VERSION/#maestro-sdk-}
TAGS=$(git describe --tags)
GIT_REVISION=$(git rev-parse HEAD)
CI_BUILD_TIME=$(date --iso-8601=seconds --utc)
echo "MAESTRO_SDK_VERSION: ${{ env.MAESTRO_SDK_VERSION }}"
echo "SEMANTIC_VERSION: $SEMANTIC_VERSION"
echo "TAGS: $TAGS"
echo "GIT_REVISION: $GIT_REVISION"
echo "CI_BUILD_TIME: $CI_BUILD_TIME"
HADDOCK_FILE=${{ env.MAESTRO_SDK_VERSION }}-haddock.tar
set -x
mv ./artifacts/artifact.tar ./artifacts/${HADDOCK_FILE}
gh release create \
--generate-notes \
--verify-tag \
--draft \
"${SEMANTIC_VERSION}" \
"./artifacts/${{ env.MAESTRO_SDK_VERSION }}.tar.gz#Source distribution file (tar.gz)" \
"./artifacts/${HADDOCK_FILE}#Haddock (tar)"
echo "::notice::Succesfully created release draft ${SEMANTIC_VERSION} from ${GIT_REVISION}. (Uploaded: ${{ env.MAESTRO_SDK_VERSION }}.tar.gz)"
- name: Setup haskell tooling
uses: haskell/actions/setup@v2
with:
ghc-version: '8.10.7'
cabal-version: '3.8'
enable-stack: true
- name: Update dependencies (cabal)
run: cabal v2-update
# - name: Publish to Hackage (cabal)
# run: |
# dir=$(mktemp -d dist-docs.XXXXXX)
# trap 'rm -r "$dir"' EXIT
# cabal v2-haddock --builddir="$dir" --haddock-for-hackage --enable-doc
# cabal upload -d --publish $dir/*-docs.tar.gz
- name: Checkout source code
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
name: Download source distribution file artifact
with:
name: source-distribution-file
path: ./artifacts
- uses: actions/download-artifact@v3
name: Download haddock artifact
with:
name: github-pages
path: ./artifacts
- name: Create release draft (GitHub)
env:
MAESTRO_SDK_VERSION: ${{needs.build.outputs.MAESTRO_SDK_VERSION}}
run: |
export GH_TOKEN=${{ secrets.GITHUB_TOKEN }}
SEMANTIC_VERSION=v${MAESTRO_SDK_VERSION/#maestro-sdk-}
TAGS=$(git describe --tags)
GIT_REVISION=$(git rev-parse HEAD)
CI_BUILD_TIME=$(date --iso-8601=seconds --utc)
echo "MAESTRO_SDK_VERSION: ${{ env.MAESTRO_SDK_VERSION }}"
echo "SEMANTIC_VERSION: $SEMANTIC_VERSION"
echo "TAGS: $TAGS"
echo "GIT_REVISION: $GIT_REVISION"
echo "CI_BUILD_TIME: $CI_BUILD_TIME"
HADDOCK_FILE=${{ env.MAESTRO_SDK_VERSION }}-haddock.tar
set -x
mv ./artifacts/artifact.tar ./artifacts/${HADDOCK_FILE}
gh release create \
--generate-notes \
--verify-tag \
--draft \
"${SEMANTIC_VERSION}" \
"./artifacts/${{ env.MAESTRO_SDK_VERSION }}.tar.gz#Source distribution file (tar.gz)" \
"./artifacts/${HADDOCK_FILE}#Haddock (tar)"
echo "::notice::Succesfully created release draft ${SEMANTIC_VERSION} from ${GIT_REVISION}. (Uploaded: ${{ env.MAESTRO_SDK_VERSION }}.tar.gz)"
- name: Setup haskell tooling
uses: haskell/actions/setup@v2
with:
ghc-version: "8.10.7"
cabal-version: "3.8"
enable-stack: true
- name: Update dependencies (cabal)
run: cabal v2-update
- uses: haskell-actions/hackage-publish@v1
with:
hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }}
packagesPath: ./dist-newstyle/sdist
publish: false
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,35 @@
1. Add `maestro-sdk` to the `build-depends` of your project.
2. Create a [Maestro API key](https://docs.gomaestro.org/docs/Getting-started/Sign-up-login).
3. Code below explains sample usage.
```haskell
module Main (main) where

import Control.Exception (try)
import Maestro.Client.V1 -- @Maestro.Client.V1@ defines all the client utilities to query Maestro API endpoints.
import Maestro.Types.V1 -- @Maestro.Types.V1@ defines all the types used.
```haskell
module Main (main) where

main :: IO ()
main = do
env <- mkMaestroEnv @'V1 "<Your-API-Key>" Preprod defaultBackoff -- This is how we create an environment against which we'll query endpoints.
chainTip :: ChainTip <- getTimestampedData <$> getChainTip env -- Maestro endpoint to get for chain-tip has data & timestamp against which data was calculated. All endpoints which are timestamped, has functions `getTimestampedData` to get for underlying data & `getTimestamp` to get the timestamp.
addressesUTxOs :: Either MaestroError [UtxoWithSlot] <-
try -- To catch for any errors, given in type `MaestroError`.
$ allPages -- Since this endpoint is paged, we have a helper utility `allPages` to accumulate data from all the pages.
$ flip
(
utxosAtMultiAddresses env
(Just True) -- We would like to have datums resolved. This is for @resolve_datums@ query parameter.
(Just False) -- We would not like to include CBOR encodings of the transaction outputs in the response.
) ["addr_test1...", "addr_test1...", "addr_test1..."] -- Mention your list of addresses to query for.
print addressesUTxOs
```
import Control.Exception (try)
import Maestro.Client.V1 -- @Maestro.Client.V1@ defines all the client utilities to query Maestro API endpoints.
import Maestro.Types.V1 -- @Maestro.Types.V1@ defines all the types used.

main :: IO ()
main = do
env <- mkMaestroEnv @'V1 "<Your-API-Key>" Preprod defaultBackoff -- This is how we create an environment against which we'll query endpoints.
chainTip :: ChainTip <- getTimestampedData <$> getChainTip env -- Maestro endpoint to get for chain-tip has data & timestamp against which data was calculated. All endpoints which are timestamped, has functions `getTimestampedData` to get for underlying data & `getTimestamp` to get the timestamp.
addressesUTxOs :: Either MaestroError [UtxoWithSlot] <-
try -- To catch for any errors, given in type `MaestroError`.
$ allPages -- Since this endpoint is paged, we have a helper utility `allPages` to accumulate data from all the pages.
$ flip
(
utxosAtMultiAddresses env
(Just True) -- We would like to have datums resolved. This is for @resolve_datums@ query parameter.
(Just False) -- We would not like to include CBOR encodings of the transaction outputs in the response.
) ["addr_test1...", "addr_test1...", "addr_test1..."] -- Mention your list of addresses to query for.
print addressesUTxOs
```

# Documentation

* [SDK Haddock](https://haddock.gomaestro.org/)
* [Maestro public docs](https://docs.gomaestro.org/)
* [Maestro API reference](https://docs.gomaestro.org/docs/category/rest-api-reference)
- [SDK Haddock](https://haddock.gomaestro.org/)
- [Maestro public docs](https://docs.gomaestro.org/)
- [Maestro API reference](https://docs.gomaestro.org/docs/category/rest-api-reference)

# Contributing

Expand Down
2 changes: 1 addition & 1 deletion maestro-sdk.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: maestro-sdk
version: 1.7.0
version: 1.7.1
synopsis: Maestro Blockchain Indexer SDK
description:
Maestro provides blockchain indexers, APIs and event management systems for the Cardano blockchain.
Expand Down