i/tendermint (#51) #117
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create release binaries | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- '*' | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
output: ${{ steps.set_env.outputs.test }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@main | |
with: | |
ref: 'main' | |
- name: featch tags | |
run: git fetch --tags | |
- name: collect integrations names | |
run: | | |
cd integrations/ | |
echo "INTEGRATIONS=$(ls | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV | |
- name: set tag | |
run: echo "TAGS=$(git tag --points-at | jq --raw-input . | jq --slurp . | jq tostring)" >> $GITHUB_ENV | |
- id: output-tags | |
uses: actions/github-script@master | |
with: | |
script: | | |
const { INTEGRATIONS, TAGS } = process.env; | |
console.log(INTEGRATIONS); | |
console.log(TAGS); | |
const integrations = JSON.parse(JSON.parse(INTEGRATIONS)); | |
const tags = JSON.parse(JSON.parse(TAGS)); | |
const selectedTags = tags.filter(it => integrations.includes(it.trim().split('/')[1]?.split('@')[0])) | |
return JSON.stringify(JSON.stringify(selectedTags)) | |
result-encoding: string | |
- name: print var | |
run: echo ${{steps.output-tags.outputs.result}} | |
- name: set | |
id: set_env | |
run: echo "::set-output name=test::${{steps.output-tags.outputs.result}}" | |
build: | |
if: needs.prepare.outputs.output != '[]' | |
runs-on: ubuntu-latest | |
needs: prepare | |
strategy: | |
matrix: | |
tag: ${{fromJSON(needs.prepare.outputs.output)}} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@main | |
with: | |
ref: 'main' | |
- name: set integration name | |
run: echo "INTEGRATION_NAME=$(echo ${{ matrix.tag }} | awk -F'[/@]' '{print $3}' | sed 's/ *$//g')" >> $GITHUB_ENV | |
- name: install yarn | |
run: npm install --global yarn | |
- name: setup lerna | |
run: yarn setup | |
- name: print integration name | |
run: echo ${{ env.INTEGRATION_NAME }} | |
- name: Build Binaries | |
run: | | |
cd integrations/${{ env.INTEGRATION_NAME }} | |
ls | |
yarn build:binaries | |
cd out | |
zip kyve-linux-arm64.zip kyve-linux-arm64 | |
rm kyve-linux-arm64 | |
zip kyve-linux-x64.zip kyve-linux-x64 | |
rm kyve-linux-x64 | |
zip kyve-macos-x64.zip kyve-macos-x64 | |
rm kyve-macos-x64 | |
cd .. | |
- name: Generate Release Body | |
run: npx extract-changelog-release ${{ github.workspace }}/integrations/${{env.INTEGRATION_NAME}}/CHANGELOG.md > RELEASE_BODY.md | |
- name: Publish the Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: RELEASE_BODY.md | |
tag_name: ${{ matrix.tag }} | |
files: integrations/${{env.INTEGRATION_NAME}}/out/* | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |