Skip to content

feat: cardano-node-api grpc port (#75) #13

feat: cardano-node-api grpc port (#75)

feat: cardano-node-api grpc port (#75) #13

Workflow file for this run

---
# The below is copied from the following URL and modified slightly
# https://dev.to/imjoseangel/release-and-deploy-ansible-collection-with-github-actions-4a62
name: Release and Deploy collection
on:
# Allow manual triggering for testing
workflow_dispatch:
# Trigger on change to galaxy.yml in main branch
push:
branches:
- main
paths:
- galaxy.yml
jobs:
create-draft-release:
runs-on: ubuntu-latest
outputs:
RELEASE_ID: ${{ steps.create-release.outputs.result }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get current version
id: cversion
run: echo "::set-output name=version::$(grep version galaxy.yml | sed -e 's:^.* ::')"
- uses: actions/github-script@v6
id: create-release
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
try {
const response = await github.rest.repos.createRelease({
draft: true,
generate_release_notes: true,
name: '${{ steps.cversion.outputs.version }}',
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: '${{ steps.cversion.outputs.version }}',
});
return response.data.id;
} catch (error) {
core.setFailed(error.message);
}
build-publish-collection:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
needs: [create-draft-release]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get current version
id: cversion
run: echo "::set-output name=version::$(grep version galaxy.yml | sed -e 's:^.* ::')"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade ansible
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build Ansible Collection
run: ansible-galaxy collection build --force
- name: Upload release asset
run: |
_filename=blinklabs-cardano-${{ steps.cversion.outputs.version }}.tar.gz
curl \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/tar+gzip" \
--data-binary @${_filename} \
https://uploads.github.com/repos/${{ github.repository }}/releases/${{ needs.create-draft-release.outputs.RELEASE_ID }}/assets?name=${_filename}
- name: Publish Ansible collection to Galaxy
run: ansible-galaxy collection publish blinklabs-cardano-${{ steps.cversion.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }}
finalize-release:
runs-on: ubuntu-latest
needs: [create-draft-release, build-publish-collection]
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ needs.create-draft-release.outputs.RELEASE_ID }},
draft: false,
});
} catch (error) {
core.setFailed(error.message);
}