Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: embed release in CI workflow #100

Merged
merged 10 commits into from
Aug 26, 2022
Merged
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.