Update durabletask-js (#633) #1574
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
# | |
# Copyright 2022 The Dapr Authors | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: Build | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- main | |
- release-* | |
# Manual trigger | |
workflow_dispatch: {} | |
env: | |
NODE_VER: 16.14.0 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
node_version: [16.14.0] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node ${{ matrix.node_version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Build package (install dependencies, lint, prettier, build) | |
run: npm run build | |
# @TODO: add a depend on the test-e2e pipeline? | |
- name: Run unit tests | |
id: tests | |
run: npm run test:unit:all | |
- name: Upload test coverage | |
uses: codecov/codecov-action@v1 | |
publish: | |
needs: build | |
if: startswith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node ${{ env.NODE_VER }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VER }} | |
registry-url: "https://registry.npmjs.org" | |
- name: Install dependencies | |
run: npm install | |
- name: Build package | |
run: npm run build-ci | |
- name: Publish to npm (@dapr/dapr) | |
run: npm publish build/ --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# dapr-client is deprecated, but we still want to publish it for a while. | |
- name: "[dapr-client] Configure to publish to dapr-client for deprecation notice reasons" | |
run: | | |
sed -i s#"@dapr/dapr"#"dapr-client"# package.json | |
echo "This has been deprecated and will not be updated anymore, please use https://www.npmjs.com/package/@dapr/dapr" > README.md | |
- name: "[dapr-client] Install dependencies" | |
run: npm install | |
- name: "[dapr-client] Build Package" | |
run: npm run build-ci | |
- name: "[dapr-client] Publish to npm (dapr-client)" | |
run: npm publish build/ --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-dev: | |
needs: build | |
if: startsWith(github.ref, 'refs/heads/main') | |
runs-on: ubuntu-latest | |
environment: development | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node ${{ env.NODE_VER }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VER }} | |
registry-url: "https://registry.npmjs.org" | |
- name: Configure package name | |
run: | | |
sed -i s#"@dapr/dapr"#"@dapr/dapr-dev"# package.json | |
cat <(echo "WARNING: This is a development version of the SDK. It is not recommended to use this version in production.\n") README.md > README.md.tmp | |
mv README.md.tmp README.md | |
- name: Configure version | |
run: | | |
# Version should be in the format of <version>-<timestamp>-<commit-hash> | |
# e.g. 1.0.0-20220101000000-abcdef | |
VERSION=$(npm version | grep '@dapr/dapr' | awk -F':' '{print $2}' | tr -d "[:space:],'") | |
TIMESTAMP=$(date -u +"%Y%m%d%H%M%S") | |
COMMIT_HASH=$(git rev-parse --short HEAD) | |
sed -i s#"\"version\": \"$VERSION\""#"\"version\": \"$VERSION-$TIMESTAMP-$COMMIT_HASH\""# package.json | |
- name: Install dependencies | |
run: npm install | |
- name: Build package | |
run: npm run build-ci | |
- name: Publish to npm (@dapr/dapr-dev) | |
run: npm publish build/ --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |