Release 1.45.0 #870
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: Build and Test | |
on: | |
release: | |
types: [published] | |
pull_request: | |
push: | |
branches: | |
- 'alpha' | |
- 'beta' | |
- 'feat/deno-runtime' | |
env: | |
DENO_DIR: .deno | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Github Info | |
run: | | |
echo "GITHUB_ACTION: $GITHUB_ACTION" | |
echo "GITHUB_ACTOR: $GITHUB_ACTOR" | |
echo "GITHUB_REF: $GITHUB_REF" | |
echo "GITHUB_HEAD_REF: $GITHUB_HEAD_REF" | |
echo "GITHUB_BASE_REF: $GITHUB_BASE_REF" | |
echo "github.event_name: ${{ github.event_name }}" | |
cat $GITHUB_EVENT_PATH | |
- name: Use Node.js 14.19.3 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14.19.3' | |
- uses: actions/checkout@v2 | |
- name: Versions | |
run: | | |
npm --versions | |
node -v | |
git version | |
- name: check package-lock | |
run: | | |
npx package-lock-check | |
- name: Cache node modules | |
id: cache-nodemodules | |
uses: actions/cache@v2 | |
with: | |
path: | | |
./node_modules | |
./deno-runtime/${{ env.DENO_DIR }} | |
key: ${{ runner.OS }}-node_modules-deno-cache-5-${{ hashFiles('./package-lock.json', './deno-runtime/deno.lock', '.github/workflows/build_and_test.yml') }} | |
- name: npm install | |
if: steps.cache-nodemodules.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Deno Info | |
run: npx deno-bin info | |
- name: Prepare workspace | |
run: | | |
tar czf /tmp/workspace.tar.gz . | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: workspace | |
path: /tmp/workspace.tar.gz | |
lint: | |
runs-on: ubuntu-latest | |
needs: prepare | |
steps: | |
- name: Use Node.js 14.19.3 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14.19.3' | |
- uses: actions/download-artifact@v2 | |
with: | |
name: workspace | |
path: /tmp | |
- name: Decompress workspace | |
run: | | |
tar xzf /tmp/workspace.tar.gz . | |
- name: Lint TypeScript Code | |
run: npm run lint | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Use Node.js 14.19.3 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14.19.3' | |
- uses: actions/download-artifact@v2 | |
with: | |
name: workspace | |
path: /tmp | |
- name: Decompress workspace | |
run: | | |
tar xzf /tmp/workspace.tar.gz . | |
- name: Test TypeScript Code | |
run: npm run test | |
build: | |
runs-on: ubuntu-latest | |
needs: lint | |
steps: | |
- name: Use Node.js 14.19.3 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14.19.3' | |
- uses: actions/download-artifact@v2 | |
with: | |
name: workspace | |
path: /tmp | |
- name: Decompress workspace | |
run: | | |
tar xzf /tmp/workspace.tar.gz . | |
- name: Compile TypeScript into JavaScript | |
run: npm run compile | |
- name: Prepare workspace | |
run: | | |
tar czf /tmp/workspace.tar.gz . | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: workspace | |
path: /tmp/workspace.tar.gz | |
publish: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta' | |
needs: test | |
steps: | |
- name: Use Node.js 14.19.3 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14.19.3' | |
- uses: actions/download-artifact@v2 | |
with: | |
name: workspace | |
path: /tmp | |
- name: Decompress workspace | |
run: | | |
tar xzf /tmp/workspace.tar.gz . | |
- name: Authenticate with registry | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc | |
- name: Publish package | |
run: | | |
if [[ '${{ github.event_name }}' = 'release' ]]; then | |
npm publish --tag latest | |
else | |
ls -la | |
# Add build number to the end of the version | |
npm version "$(node -p "require('./package.json').version").${{ github.run_number }}" --no-git-tag-version | |
GIT_BRANCH="${GITHUB_REF#*heads/}" | |
if [[ $GIT_BRANCH == 'alpha' ]]; then | |
npm run go-publish-alpha | |
else | |
npm run go-publish-beta | |
fi; | |
fi; |