Skip to content

Commit

Permalink
Merge branch 'master' into fix/generate-template-from-spec-with-ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Souvikns authored Mar 22, 2024
2 parents f5247f3 + f6f2afc commit f5d4c7c
Show file tree
Hide file tree
Showing 22 changed files with 10,240 additions and 7,964 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/bounty-program-commands.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# This workflow is centrally managed at https://github.com/asyncapi/.github/
# Don't make changes to this file in this repository, as they will be overwritten with
# changes made to the same file in the abovementioned repository.

# The purpose of this workflow is to allow Bounty Team members
# (https://github.com/orgs/asyncapi/teams/bounty_team) to issue commands to the
# organization's global AsyncAPI bot related to the Bounty Program, while at the
# same time preventing unauthorized users from misusing them.

name: Bounty Program commands

on:
issue_comment:
types:
- created

jobs:
guard-against-unauthorized-use:
if: >
github.actor != ('aeworxet' || 'thulieblack') &&
(
contains(github.event.comment.body, '/bounty' )
)
runs-on: ubuntu-latest

steps:
- name: ❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command
uses: actions/github-script@v6

with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const commentText = `❌ @${{github.actor}} is not authorized to use the Bounty Program's commands.
These commands can only be used by members of the [Bounty Team](https://github.com/orgs/asyncapi/teams/bounty_team).`;
console.log(`❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command.`);
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentText
})
add-label-bounty:
if: >
github.actor == ('aeworxet' || 'thulieblack') &&
(
contains(github.event.comment.body, '/bounty' )
)
runs-on: ubuntu-latest
env:
BOUNTY_PROGRAM_LABELS_JSON: |
[
{"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"}
]
steps:
- name: Add label `bounty`
uses: actions/github-script@v6

with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON);
let LIST_OF_LABELS_FOR_REPO = await github.rest.issues.listLabelsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
});
LIST_OF_LABELS_FOR_REPO = LIST_OF_LABELS_FOR_REPO.data.map(key => key.name);
if (!LIST_OF_LABELS_FOR_REPO.includes(BOUNTY_PROGRAM_LABELS[0].name)) {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: BOUNTY_PROGRAM_LABELS[0].name,
color: BOUNTY_PROGRAM_LABELS[0].color,
description: BOUNTY_PROGRAM_LABELS[0].description
});
}
console.log('Adding label `bounty`...');
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [BOUNTY_PROGRAM_LABELS[0].name]
})
4 changes: 2 additions & 2 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
- if: steps.packagejson.outputs.exists == 'true'
name: Bumping latest version of this package in other repositories
uses: derberg/npm-dependency-manager-for-your-github-org@26a4f13d740254719971325046822a169aaa7441 # using v5.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v5.0.0
uses: derberg/npm-dependency-manager-for-your-github-org@3df56be95bcaa5c76a9c9a4af863ab151545b649 # using v6.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v6
with:
github_token: ${{ secrets.GH_TOKEN }}
committer_username: asyncapi-bot
committer_email: [email protected]
repos_to_ignore: spec,bindings
repos_to_ignore: spec,bindings,saunter
67 changes: 67 additions & 0 deletions .github/workflows/if-docker-pr-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#This action is centrally managed in https://github.com/asyncapi/.github/
#Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo
#It does magic only if there is a Dockerfile in the root of the project
name: PR testing - if Docker

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
test-docker-pr:
name: Test Docker build
runs-on: ubuntu-latest

steps:
- if: >
!github.event.pull_request.draft && !(
(github.actor == 'asyncapi-bot' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'asyncapi-bot-eve' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'allcontributors[bot]' &&
startsWith(github.event.pull_request.title, 'docs: add')
)
)
id: should_run
name: Should Run
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
- if: steps.should_run.outputs.shouldrun == 'true'
name: Checkout repository
uses: actions/checkout@v3

- if: steps.should_run.outputs.shouldrun == 'true'
name: Check if project has a Dockerfile
id: docker
run: test -e ./Dockerfile && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
shell: bash

- if: steps.docker.outputs.exists == 'true'
name: Set up Docker Buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # use 2.5.0 https://github.com/docker/setup-buildx-action/releases/tag/v2.5.0

- if: steps.docker.outputs.exists == 'true'
name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # use 4.3.0 https://github.com/docker/metadata-action/releases/tag/v4.3.0
with:
images: ${{ env.IMAGE_NAME }}

- if: steps.docker.outputs.exists == 'true'
name: Build Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # use 4.0.0 https://github.com/docker/build-push-action/releases/tag/v4.0.0
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
25 changes: 25 additions & 0 deletions .github/workflows/release-chocolatey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,37 @@ jobs:
echo "Setting version to $version"
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Check if this is a new version to release
id: check_new_version
run: |
$output = choco search asyncapi-cli --version=${{ steps.release_version.outputs.version }}
# Output is of the form:
# Chocolatey v2.2.2
# asyncapi-cli 0.0.1 [Approved]
# 1 packages found.
# If the version is not found, the output will of the form:
# Chocolatey v2.2.2
# 0 packages found.
if ($output -match "0 packages found.") {
echo "This is a new version to release"
echo "new_version=true" >> $env:GITHUB_OUTPUT
}
else {
echo "This is not a new version to release"
echo "new_version=false" >> $env:GITHUB_OUTPUT
}
- name: Download release
if: steps.check_new_version.outputs.new_version == 'true'
run: |
echo "Downloading release assets for version ${{ steps.release_version.outputs.version }}"
mkdir -p ./dist/win32
curl -L "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x64.exe" -o "./dist/win32/asyncapi.x64.exe"
curl -L "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x86.exe" -o "./dist/win32/asyncapi.x86.exe"
- name: Get Checksum of the release
if: steps.check_new_version.outputs.new_version == 'true'
id: release_checksum
run: |
$checksum = (Get-FileHash -Path "./dist/win32/asyncapi.x86.exe" -Algorithm SHA256).Hash
Expand All @@ -51,11 +74,13 @@ jobs:
echo "checksum64=$checksum64" >> $env:GITHUB_OUTPUT
- name: Make nuspec from the template
if: steps.check_new_version.outputs.new_version == 'true'
run: |
cd ./.github/workflows/deploy/chocolatey
pwsh -File ./replace.ps1 -version ${{ steps.release_version.outputs.version }} -checksum ${{ steps.release_checksum.outputs.checksum }} -checksum64 ${{ steps.release_checksum.outputs.checksum64 }}
- name: Run Chocolatey Pack
if: steps.check_new_version.outputs.new_version == 'true'
run: |
cd ./.github/workflows/deploy/chocolatey
choco pack ./asyncapi-cli.nuspec
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default async function () {
console.log('Connection with Shrek established')
}

export const lifecycleEvent = 'onServerConnectionOpen'
export const channels = ['/chat']
Loading

0 comments on commit f5d4c7c

Please sign in to comment.