Skip to content

chore: optional comms #907

chore: optional comms

chore: optional comms #907

on:
push:
branches:
- main
pull_request:
release:
types:
- created
name: build-deploy
jobs:
check_and_build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
outputs:
dcl_protocol_s3_bucket_key: ${{ steps.publish_dcl_protocol.outputs.s3-bucket-key }}
steps:
- uses: actions/checkout@v2
- name: install
run: make install
- name: buf build
run: make buf-build
- name: build and compile test
run: make test
- name: publish packages
uses: menduz/oddish-action@master
id: publish_dcl_protocol
with:
registry-url: 'https://registry.npmjs.org'
access: public
## use action runId instead of current date to generate snapshot numbers
deterministic-snapshot: true
## sign the deployment
provenance: true
## publish every package to s3
s3-bucket: ${{ secrets.SDK_TEAM_S3_BUCKET }}
s3-bucket-key-prefix: '@dcl/protocol/branch/${{ steps.myref.outputs.branch }}'
## inform gitlab after publishing to proceed with CDN propagation
gitlab-token: ${{ secrets.GITLAB_TOKEN }}
gitlab-pipeline-url: ${{ secrets.GITLAB_URL }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.SDK_TEAM_AWS_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SDK_TEAM_AWS_SECRET }}
notify_deployment:
needs: [check_and_build]
if: ${{ github.event.pull_request.number }}
runs-on: ubuntu-latest
name: Deployment Notification
steps:
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Test this pull request
- name: Get the current branch name
shell: bash
run: node -e "console.log('::set-output name=branch::' + ('${{github.head_ref}}' || '$GITHUB_REF'.replace('refs/heads/','')) )"
id: myref
- name: Generate S3 URL
id: url-generator
run: |
body=$(echo ${{ secrets.SDK_TEAM_S3_BASE_URL }})/${{ needs.check_and_build.outputs.dcl_protocol_s3_bucket_key }}
echo ::set-output name=body::$body
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
# Test this pull request
- The `@dcl/protocol` package can be tested in scenes by running
```bash
npm install "${{ steps.url-generator.outputs.body }}"
```
edit-mode: replace