Merge branch 'main' of https://github.com/configu/configu #18
Workflow file for this run
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: "CD: @configu/lib npm package" | |
on: | |
push: | |
tags: | |
- lib-* | |
env: | |
PACKAGE_NAME: "@configu/lib" | |
jobs: | |
build_and_deploy: | |
name: Build and deploy | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/deploy-start-action | |
id: deployment | |
with: | |
package-name: ${{ env.PACKAGE_NAME }} | |
slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
- uses: ./.github/actions/ts-env-action | |
- uses: ./.github/actions/ts-env-action | |
with: | |
dependencies-root: "ts" | |
- uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
# ---------- | |
- name: Bump package version | |
run: | | |
cd ${{ env.CWD }} | |
npm --no-git-tag-version version ${{ steps.deployment.outputs.release-version }} \ | |
--workspace=${{ env.PACKAGE_NAME }} | |
- name: Build package code | |
run: | | |
cd ${{ env.CWD }} | |
npm run build \ | |
--workspace=${{ env.PACKAGE_NAME }} | |
- name: Publish to npm | |
run: | | |
cd ${{ env.CWD }} | |
npm publish --access public --provenance --tag ${{ steps.deployment.outputs.release-channel }} \ | |
--workspace=${{ env.PACKAGE_NAME }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Build package docs | |
if: ${{ steps.deployment.outputs.release-channel == 'latest' }} | |
run: | | |
cd ${{ env.CWD }} | |
npm run build:docs | |
- name: Publish docs | |
if: ${{ steps.deployment.outputs.release-channel == 'latest' }} | |
run: | | |
aws s3 sync ${{ env.CWD }}/docs s3://${{ env.S3_BUCKET }}/${{ env.S3_FOLDER }} | |
aws cloudfront create-invalidation --distribution-id ${{ env.CLOUDFRONT_DISTRIBUTION }} --paths "/${{ env.S3_FOLDER }}*" | |
env: | |
S3_BUCKET: "oss.configu.com" | |
S3_FOLDER: "ts" | |
CLOUDFRONT_DISTRIBUTION: "E7C5AL5O299SC" | |
# ---------- | |
- uses: ./.github/actions/deploy-end-action | |
if: always() | |
with: | |
package-name: ${{ env.PACKAGE_NAME }} | |
package-version: ${{ steps.deployment.outputs.release-version }} | |
slack-webhook: ${{ secrets.SLACK_WEBHOOK_URL }} |