upload-package #40
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: upload-package | |
on: | |
repository_dispatch: | |
types: [upload-package] | |
jobs: | |
upload-package: | |
runs-on: ubuntu-20.04 | |
outputs: | |
kosli_cli_version: ${{ steps.upload-package.outputs.kosli_cli_version }} | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.KOSLI_REPORTER_SOURCES_AWS_ACCOUNT_ID }}:role/${{ github.event.repository.name }} | |
aws-region: ${{ secrets.KOSLI_REPORTER_SOURCES_AWS_REGION }} | |
role-duration-seconds: 900 | |
role-session-name: ${{ github.event.repository.name }} | |
- name: Upload Reporter lambda package | |
id: upload-package | |
env: | |
TAG: ${{ github.event.client_payload.kosli_cli_tag }} | |
run: | | |
KOSLI_CLI_VERSION="${TAG:1}" | |
echo "kosli_cli_version=$KOSLI_CLI_VERSION" >> $GITHUB_OUTPUT | |
curl -Lo kosli_${KOSLI_CLI_VERSION}_linux_amd64.tar.gz https://github.com/kosli-dev/cli/releases/download/${TAG}/kosli_${KOSLI_CLI_VERSION}_linux_amd64.tar.gz | |
tar -xf kosli_${KOSLI_CLI_VERSION}_linux_amd64.tar.gz -C . && rm kosli_${KOSLI_CLI_VERSION}_linux_amd64.tar.gz | |
zip -j kosli_lambda_${KOSLI_CLI_VERSION}.zip deployment/reporter-lambda-src/* kosli | |
aws s3 cp kosli_lambda_${KOSLI_CLI_VERSION}.zip s3://${{ secrets.KOSLI_REPORTER_SOURCES_S3_NAME }}/kosli_lambda_${TAG}.zip | |
deploy-reporters: | |
runs-on: ubuntu-20.04 | |
needs: [upload-package] | |
steps: | |
- name: Repository Dispatch | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.KOSLI_REPORTER_REPO_ACCESS_TOKEN }} | |
repository: kosli-dev/kosli-reporter | |
event-type: deploy-reporter | |
client-payload: '{"kosli_cli_version": "${{ needs.upload-package.outputs.kosli_cli_version }}"}' |