Skip to content

Commit

Permalink
chore: embed release in CI workflow (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
manumena committed Aug 26, 2022
1 parent 52616ea commit 97f6587
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 40 deletions.
22 changes: 3 additions & 19 deletions .github/workflows/ci.yml → .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
on:
push:
tags:
- '*'
branches:
- main
pull_request:
release:
types:
- created
workflow_call:

name: CI
name: Build and test
jobs:
build:
build-and-test:
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: stub
steps:
- uses: actions/checkout@master
- name: Use Node.js 16.x
Expand All @@ -32,10 +23,3 @@ jobs:
run: yarn api-extractor-ci
- name: test
run: yarn test
- name: Publish
uses: menduz/oddish-action@master
with:
registry-url: "https://registry.npmjs.org"
access: public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/release-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
push:
branches:
- main

name: Release and publish NPM package
jobs:

build-and-test:
uses: ./.github/workflows/build-and-test.yml

release:
runs-on: ubuntu-latest
permissions: write-all
needs: build-and-test
steps:
- uses: decentraland/gh-action-release@0.3.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

publish:
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: stub
needs: release
if: ${{ success() }}
env:
NODE_AUTH_TOKEN: stub
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- name: get latest release and export as GIT_TAG
run: echo "GIT_TAG=$(git tag | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -1)" > $GITHUB_ENV
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'yarn'
- name: install
run: yarn install --frozen-lockfile
- name: check code lint
run: yarn lint:check
- name: build
run: yarn build
- name: api-extractor
run: yarn api-extractor-ci
- name: Publish
uses: menduz/oddish-action@master
with:
registry-url: "https://registry.npmjs.org"
access: public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
21 changes: 0 additions & 21 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 97f6587

Please sign in to comment.