Skip to content

Commit

Permalink
First version of github actions (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
fboucquez committed Jan 13, 2022
1 parent 6d02077 commit 206baca
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 61 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,95 @@
name: Build
on: [push]
jobs:
build:
name: Build, Test, Coverage
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 15.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm pack
- run: npm test
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12.x
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run lint
doc:
name: Github Pages Deploy
runs-on: ubuntu-latest
if: contains(github.base_ref, 'dev')
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12.x
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run doc
- name: Deploy Docs
uses: JamesIves/github-pages-deploy-action@v4.2.2
with:
branch: gh-pages
folder: ts-docs
alpha:
needs: build
name: Alpha NPM Deploy
runs-on: ubuntu-latest
if: contains(github.base_ref, 'dev')
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12.x
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm pack
- id: version
run: echo "version=$(npm run version --silent)" >> $GITHUB_ENV
- id: newVersion
run: echo "newVersion=${{ env.version }}-alpha-${GITHUB_SHA::7}" >> $GITHUB_ENV
- run: echo "Deploying version ${{ env.newVersion }}"
- run: npm version "${{ env.newVersion }}" --commit-hooks false --git-tag-version false
- run: npm publish --tag alpha
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# steps:
# - uses: actions/checkout@v2
# - run: sudo rm /usr/local/bin/docker-compose
# - run: curl -L https://github.com/docker/compose/releases/download/${env.DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
# - run: chmod +x docker-compose
# - sudo mv docker-compose /usr/local/bin
# - name: Build symbol.yml
# run: python3 -m catparser --schema symbol/all.cats --include symbol --output dist/symbol.yml
# - name: Build nem.yml
# run: python3 -m catparser --schema nem/all.cats --include nem --output dist/nem.yml
# - run: ls -la dist
# - uses: 'marvinpinto/action-automatic-releases@latest'
# name: Publish Pre Release
# if: github.ref == 'refs/heads/main'
# with:
# repo_token: '${{ secrets.GITHUB_TOKEN }}'
# automatic_release_tag: 'alpha'
# prerelease: true
# title: 'Alpha Build'
# files: |
# dist/symbol.yml
# dist/nem.yml
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,59 @@
name: Release
on:
workflow_dispatch:
jobs:
publish:
name: NPM Publish
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12.x
registry-url: https://registry.npmjs.org
- run: npm ci
- id: version
run: echo "version=$(npm run version --silent)" >> $GITHUB_ENV
- run: echo "Deploying version ${{ env.version }}"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
tag:
name: Tag and Release
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%^b-%d-%Y')"
- id: version
run: echo "version=$(npm run version --silent)" >> $GITHUB_ENV
- uses: 'marvinpinto/action-automatic-releases@latest'
name: Create tag and release
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
automatic_release_tag: 'v${{ env.version }}'
prerelease: true
title: '[${{ env.version }}] - ${{ steps.date.outputs.date }}'
postRelease:
name: Version Upgrade
needs: tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12.x
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm version patch -m "Increasing version to %s" --git-tag-version false
- id: newVersion
run: echo "newVersion=$(npm run version --silent)" >> $GITHUB_ENV
- run: echo "Upgraded to version ${{ env.newVersion }}"
- run: npm run oclif-doc
- uses: EndBug/add-and-commit@v7
with:
message: Creating new version ${{ env.newVersion }}
3 changes: 0 additions & 3 deletions .gitmodules
@@ -1,3 +0,0 @@
[submodule "travis"]
path = travis
url = https://github.com/nemgrouplimited/travis-functions.git
53 changes: 0 additions & 53 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -6,7 +6,7 @@ Symbol CLI tool that allows you creating, configuring and running Symbol's c
[![Version](https://img.shields.io/npm/v/symbol-bootstrap.svg)](https://npmjs.org/package/symbol-bootstrap)
[![Downloads/week](https://img.shields.io/npm/dw/symbol-bootstrap.svg)](https://npmjs.org/package/symbol-bootstrap)
[![License](https://img.shields.io/npm/l/symbol-bootstrap.svg)](https://github.com/fboucquez/symbol-bootstrap/blob/master/package.json)
[![Build Status](https://travis-ci.com/fboucquez/symbol-bootstrap.svg?branch=main)](https://travis-ci.com/fboucquez/symbol-bootstrap)
[![Build](https://github.com/fboucquez/symbol-bootstrap/actions/workflows/build.yml/badge.svg)](https://github.com/fboucquez/symbol-bootstrap/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/fboucquez/symbol-bootstrap/badge.svg?branch=main)](https://coveralls.io/github/fboucquez/symbol-bootstrap?branch=main)
[![Api Doc](https://img.shields.io/badge/api-doc-blue.svg)](https://fboucquez.github.io/symbol-bootstrap/)

Expand Down
7 changes: 4 additions & 3 deletions alpha.sh
@@ -1,10 +1,11 @@
#!/usr/bin/env bash
set -e
. ./travis/node-functions.sh
VERSION="$(node_load_version)"
VERSION="$(npm run version --silent)"
TAG=${1:-alpha}
echo "publishing $VERSION with tag $TAG"
npm pack
/bin/bash travis/node-functions.sh node_publish_alpha $TAG
NEW_VERSION="$VERSION-$TAG-$(date +%Y%m%d%H%M)"
npm version "$NEW_VERSION" --commit-hooks false --git-tag-version false
npm publish --tag alpha
npm version "$VERSION" --commit-hooks false --git-tag-version false
npm run style:fix
1 change: 0 additions & 1 deletion travis
Submodule travis deleted from 0bb6db

0 comments on commit 206baca

Please sign in to comment.