Skip to content

Commit

Permalink
ci: add release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
abarisain committed Feb 2, 2021
1 parent aeba467 commit 52ae8de
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Test and build release

on:
push:
tags:
- 'v*'

jobs:
create-github-release:
name: Create Github Release
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.create-github-release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Github Release
id: create-github-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

build:
name: Test and build
runs-on: ubuntu-20.04
needs: create-github-release

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '15.x'
- name: Cache Node.js modules
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: npm ci
- name: Lint, test and build release SDK
run: npm run ci
- name: Archive build artifacts
run: zip -r --junk-paths build.zip build/*
- name: Upload Release Asset (minified javascript)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-github-release.outputs.upload_url }}
asset_path: build/batch-webview-sdk.min.js
asset_name: batch-webview-sdk.min.js
asset_content_type: application/javascript
- name: Upload Release Asset (.zip)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-github-release.outputs.upload_url }}
asset_path: build.zip
asset_name: batch-webview-sdk-${{ github.ref }}.zip
asset_content_type: application/javascript
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
node_modules
.DS_Store
coverage
coverage
build.zip

0 comments on commit 52ae8de

Please sign in to comment.