From 26bc8de137a803cee338e40e4f35cbd6cab16dbb Mon Sep 17 00:00:00 2001 From: mbreithecker Date: Wed, 6 Jul 2022 10:54:24 +0200 Subject: [PATCH] chore: add release-builder workflow --- .github/workflows/configuration.json | 32 +++++++++ .github/workflows/release.yml | 101 ++++++++++----------------- 2 files changed, 70 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/configuration.json diff --git a/.github/workflows/configuration.json b/.github/workflows/configuration.json new file mode 100644 index 0000000..6309198 --- /dev/null +++ b/.github/workflows/configuration.json @@ -0,0 +1,32 @@ +{ + "categories": [ + { + "title": "### Features", + "labels": ["feat"] + }, + { + "title": "### Improvements", + "labels": ["chore"] + }, + { + "title": "### Fixes", + "labels": ["fix"] + } + ], + "template": "${{CHANGELOG}}\n\n
\nUncategorized\n\n${{UNCATEGORIZED}}\n
", + "pr_template": "- ${{TITLE}}", + "empty_template": "- no changes", + "label_extractor": [ + { + "pattern": "(chore|fix|feat)!?: (.*)", + "target": "$1", + "flags": "gu" + } + ], + "transformers": [ + { + "pattern": "(chore|fix|feat)!?: (.*)", + "target": "$2" + } + ] +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b80dec..5529505 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,70 +1,45 @@ -name: Release - on: - release: - types: [released] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - + push: + # Pattern matched against refs/tags + tags: + - '*' # Push events to every tag not containing / +name: Create Release Binaries jobs: - binaries: - name: Build release binaries. + generate: + name: Create release-artifacts runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 - - - name: Install yarn. - run: npm install -g yarn - - name: Install dependencies. - run: yarn install - - name: Build. - run: yarn build:binaries - - - uses: actions/upload-artifact@v3 + - name: Checkout the repository + uses: actions/checkout@main + - name: Build Binaries + run: | + yarn install + yarn build + yarn build:binaries + cd out + zip kyve-linux.zip kyve-linux + rm kyve-linux + zip kyve-macos.zip kyve-macos + rm kyve-macos + cd .. + - uses: google-github-actions/release-please-action@v3 with: - name: checksum.txt - path: ./out/checksum.txt - - uses: actions/upload-artifact@v3 + release-type: node + package-name: release-please-action + - name: Generate Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v3 with: - name: kyve-linux - path: ./out/kyve-linux - - uses: actions/upload-artifact@v3 + configuration: ".github/workflows/configuration.json" + commitMode: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish the Release + uses: softprops/action-gh-release@v1 with: - name: kyve-macos - path: ./out/kyve-macos - - docker: - name: Build and publish Docker container. - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Login to Docker. - run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} - - - name: Build the Docker image. - run: docker build -t kyve/cosmos:${GITHUB_REF#refs/tags/} -t kyve/cosmos:latest . - - - name: Push to Docker hub. - run: docker push -a kyve/cosmos - - webhook: - name: Post a message to Discord. - needs: [binaries, docker] - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 - - - name: Install yarn. - run: npm install -g yarn - - name: Install dependencies. - run: yarn add webhook-discord - - - name: Run script. - run: DISCORD=${{ secrets.DISCORD }} VERSION=${GITHUB_REF#refs/tags/} node .github/webhook.js + body: ${{steps.github_release.outputs.changelog}} + tag_name: ${{ steps.vars.outputs.tag_name }} + files: out/* + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}