From 67c9482ac600e182b58982fd26819c90936606f6 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 1 Jun 2020 12:52:31 +0200 Subject: [PATCH] adds gh-actions --- .github/workflows/release.yml | 69 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 39 ++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..eac0597 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release + +on: + push: + branches: + - stable + +jobs: + build: + runs-on: ubuntu-18.04 + outputs: + version: ${{ env.VERSION }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + - run: echo "::set-env name=VERSION::$(jq '.version' package.json)" + - run: yarn install + - run: yarn build + - run: yarn pack --filename artifact.tgz + - uses: actions/upload-artifact@v2 + with: + name: artifact + path: artifact.tgz + - run: yarn ci + + npm-publish: + runs-on: ubuntu-18.04 + needs: build + steps: + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: 'https://registry.npmjs.org' + - uses: actions/download-artifact@v2 + with: + name: artifact + path: /tmp + - run: tar xvzf /tmp/artifact.tgz + - run: yarn publish ./package + env: + VERSION: ${{ fromJSON(needs.build.outputs.version) }} + NODE_AUTH_TOKEN: ${{ secrets.npm_token }} + + tag-release: + runs-on: ubuntu-18.04 + needs: [build, npm-publish] + steps: + - uses: actions/checkout@v2 + - name: Create TAG + run: | + git tag $RELEASE + git push --follow-tags + env: + release: v${{ fromJSON(needs.build.outputs.version) }} + + gh-release: + runs-on: ubuntu-18.04 + needs: [build, npm-publish] + steps: + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ fromJSON(needs.build.outputs.version) }} + release_name: Release ${{ fromJSON(needs.build.outputs.version) }} + body: Release ${{ fromJSON(needs.build.outputs.version) }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0d5fc36 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: Test + +on: + - push + - pull_request + +jobs: + build: + strategy: + matrix: + os: [ ubuntu-18.04 ] + node: [ 10, 12 ] + name: Test Nodejs v${{ matrix.node }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - run: yarn install + - run: yarn build + - run: yarn ci + - name: Publish Coveralls + uses: coverallsapp/github-action@v1.1.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: run-nodejs-v${{ matrix.node }}-${{ matrix.os }} + parallel: true + + finish: + name: Finish + needs: build + runs-on: ubuntu-18.04 + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v1.1.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true