mirror of
https://github.com/ivabus/pantry
synced 2024-11-23 00:45:07 +03:00
publish to new packages topic
This commit is contained in:
parent
b68e81ab2e
commit
cc5ec8e03e
3 changed files with 18 additions and 1 deletions
17
.github/scripts/index-packages.ts
vendored
17
.github/scripts/index-packages.ts
vendored
|
@ -3,9 +3,13 @@
|
|||
import { usePantry } from "hooks"
|
||||
import * as ARGV from "./utils/args.ts"
|
||||
import { SQSClient, SendMessageCommand } from "npm:@aws-sdk/client-sqs@^3"
|
||||
import { SNSClient, PublishCommand } from "npm:@aws-sdk/client-sns"
|
||||
import { panic } from "utils"
|
||||
|
||||
const sqsClient = new SQSClient({ region: Deno.env.get("AWS_REGION") ?? panic("No region specified") })
|
||||
const region = Deno.env.get("AWS_REGION") ?? panic("No region specified")
|
||||
const sqsClient = new SQSClient({ region })
|
||||
const snsClient = new SNSClient({ region })
|
||||
|
||||
const pantry = usePantry()
|
||||
|
||||
const pkgs = await ARGV.toArray(ARGV.pkgs())
|
||||
|
@ -20,6 +24,8 @@ for(const pkg of pkgs) {
|
|||
github: yml?.versions?.github || "",
|
||||
// TODO: add other useable data here eventually
|
||||
}
|
||||
|
||||
// DEPRECATED: This is the old way of doing things
|
||||
const res = await sqsClient.send(new SendMessageCommand({
|
||||
MessageGroupId: 'project',
|
||||
MessageDeduplicationId: project,
|
||||
|
@ -27,6 +33,15 @@ for(const pkg of pkgs) {
|
|||
QueueUrl: Deno.env.get("SQS_GENERATE_PACKAGE_DETAILS_URL")!,
|
||||
}))
|
||||
console.log(`SQS task for pkg:${project} messageId:${res.MessageId}`)
|
||||
|
||||
const snsMessage = await snsClient.send(new PublishCommand({
|
||||
TopicArn: Deno.env.get("SNS_NEW_PACKAGES_TOPIC")!,
|
||||
Message: JSON.stringify(taskMessage),
|
||||
MessageGroupId: 'project',
|
||||
MessageDeduplicationId: project,
|
||||
}))
|
||||
|
||||
console.log(`SNS message published for pkg:${project} messageId:${snsMessage.MessageId}`)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
|
1
.github/workflows/cd.yml
vendored
1
.github/workflows/cd.yml
vendored
|
@ -82,6 +82,7 @@ jobs:
|
|||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
SQS_GENERATE_PACKAGE_DETAILS_URL: ${{ secrets.SQS_GENERATE_PACKAGE_DETAILS_URL }}
|
||||
SNS_NEW_PACKAGES_TOPIC: ${{ secrets.SNS_NEW_PACKAGES_TOPIC }}
|
||||
|
||||
|
||||
bottle-standalone:
|
||||
|
|
1
.github/workflows/new-version.yml
vendored
1
.github/workflows/new-version.yml
vendored
|
@ -85,3 +85,4 @@ jobs:
|
|||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
SQS_GENERATE_PACKAGE_DETAILS_URL: ${{ secrets.SQS_GENERATE_PACKAGE_DETAILS_URL }}
|
||||
SNS_NEW_PACKAGES_TOPIC: ${{ secrets.SNS_NEW_PACKAGES_TOPIC }}
|
||||
|
|
Loading…
Reference in a new issue