mirror of
https://github.com/ivabus/pantry
synced 2024-11-10 02:25:18 +03:00
Merge pull request #2330 from teaxyz/remove-index-packages
remove index packages
This commit is contained in:
commit
ddb00b3d20
60
.github/scripts/index-packages.ts
vendored
60
.github/scripts/index-packages.ts
vendored
|
@ -1,60 +0,0 @@
|
|||
#!/usr/bin/env -S tea -E
|
||||
|
||||
/*---
|
||||
args:
|
||||
- deno
|
||||
- run
|
||||
- --allow-read
|
||||
- --allow-net
|
||||
- --allow-env
|
||||
- --allow-sys
|
||||
dependencies:
|
||||
deno.land: =1.34.2
|
||||
---*/
|
||||
|
||||
import { SQSClient, SendMessageCommand } from "npm:@aws-sdk/client-sqs@^3"
|
||||
import { SNSClient, PublishCommand } from "npm:@aws-sdk/client-sns@^3"
|
||||
import * as ARGV from "./utils/args.ts"
|
||||
import { hooks, utils } from "tea"
|
||||
const { usePantry } = hooks
|
||||
|
||||
const region = Deno.env.get("AWS_REGION") ?? utils.panic("No region specified")
|
||||
const sqsClient = new SQSClient({ region })
|
||||
const snsClient = new SNSClient({ region })
|
||||
|
||||
const pantry = usePantry()
|
||||
|
||||
const pkgs = await ARGV.toArray(ARGV.pkgs())
|
||||
for(const pkg of pkgs) {
|
||||
try {
|
||||
const yml = await pantry.project(pkg).yaml()
|
||||
|
||||
const project = pkg.project
|
||||
|
||||
const taskMessage = {
|
||||
project,
|
||||
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,
|
||||
MessageBody: JSON.stringify(taskMessage),
|
||||
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);
|
||||
}
|
||||
}
|
20
.github/workflows/cd.yml
vendored
20
.github/workflows/cd.yml
vendored
|
@ -65,26 +65,6 @@ jobs:
|
|||
AWS_S3_CACHE: ${{ secrets.AWS_S3_CACHE }}
|
||||
PR: ${{ needs.bottle.outputs.pr }}
|
||||
|
||||
index_data:
|
||||
needs: [bottle-pr]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ needs.cd.outputs.has-artifacts == 'true' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: teaxyz/setup@v0
|
||||
with:
|
||||
srcroot: null
|
||||
- uses: teaxyz/brewkit/actions/cache@v0
|
||||
- run: ./.github/scripts/index-packages.ts ${{ inputs.projects }}
|
||||
env:
|
||||
TEA_PANTRY_PATH: ${{ github.workspace }}
|
||||
AWS_REGION: us-east-1
|
||||
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:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [cd]
|
||||
|
|
18
.github/workflows/new-version.yml
vendored
18
.github/workflows/new-version.yml
vendored
|
@ -68,21 +68,3 @@ jobs:
|
|||
platform: ${{ inputs.platform }}
|
||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||
slack-channel: ${{ secrets.SLACK_CHANNEL }}
|
||||
|
||||
index_data:
|
||||
needs: [bottle]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: teaxyz/setup@v0
|
||||
with:
|
||||
srcroot: null
|
||||
- uses: teaxyz/brewkit/actions/cache@v0
|
||||
- run: ./.github/scripts/index-packages.ts ${{ inputs.projects }}
|
||||
env:
|
||||
TEA_PANTRY_PATH: ${{ github.workspace }}
|
||||
AWS_REGION: us-east-1
|
||||
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