Merge pull request #12 from ghrcdaac/mlh0079-cicd-testing #59
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 & Release | |
on: | |
pull_request: | |
push: | |
tags: | |
- v* | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ['16.x'] | |
python-version: ['3.8'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm install | |
- run: npm run build | |
- run: npm run package | |
- run: python create_package.py | |
create_release: | |
needs: build | |
if: contains(github.ref, '/tags/v') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ['16.x'] | |
python-version: ['3.8'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get tag version | |
id: tag_name | |
run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | |
- name: Get repo name | |
id: repo_name | |
run: echo ::set-output name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | sed -e "s/:refs//") | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Build a release | |
run: | | |
npm install | |
npm run build | |
npm run package | |
python create_package.py | |
bash create_release.sh $SOURCE_TAG | |
env: | |
SOURCE_TAG: ${{ steps.tag_name.outputs.SOURCE_TAG }} | |
SECRET_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPO: ${{ steps.repo_name.outputs.REPOSITORY_NAME }} |