Skip to content

Commit

Permalink
Merge pull request #905 from relative-ci/update-build-task
Browse files Browse the repository at this point in the history
Update build task
  • Loading branch information
vio authored Jul 26, 2023
2 parents adcc4d4 + 32666ff commit 7c5e8a3
Show file tree
Hide file tree
Showing 13 changed files with 20,717 additions and 1,041 deletions.
21 changes: 0 additions & 21 deletions .circleci/config.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ updates:
commit-message:
prefix: "chore(deps)"
target-branch: "update-dependencies"
open-pull-requests-limit: 10
82 changes: 82 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: ci
on:
push:
branches:
- master
tags:
- v*
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# Cache packages when the branch is not update-dependencies or dependabot/*
- name: Resolve caching
id: cache
if: ${{ github.ref_name != 'update-dependencies' && !startsWith(github.ref_name, 'dependabot/') }}
run: echo "PACKAGE=npm" >> $GITHUB_OUTPUT

- name: Use Node.js
uses: actions/[email protected]
with:
node-version-file: ".nvmrc"
cache: ${{ steps.cache.outputs.PACKAGE }}

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm run test

- name: Upload dist files
uses: actions/upload-artifact@v3
with:
name: dist-files
retention-days: 1
path: |
lib/**/*
publish:
# Run only for version tags
if: contains(github.ref, 'refs/tags/v')
needs:
- build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3

# Cache packages when the branch is not update-dependencies or dependabot/*
- name: Resolve caching
id: cache
if: ${{ github.ref_name != 'update-dependencies' && !startsWith(github.ref_name, 'dependabot/') }}
run: echo "PACKAGE=npm" >> $GITHUB_OUTPUT

- name: Use Node.js
uses: actions/[email protected]
with:
node-version-file: ".nvmrc"
cache: ${{ steps.cache.outputs.PACKAGE }}
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Download dist files
uses: actions/download-artifact@v3
with:
name: dist-files

- name: Publish
run: npm run release
env:
NPM_CONFIG_PROVENANCE: true
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ jest.config.js
jsconfig.json
src
test
config
scripts
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

[![npm](https://img.shields.io/npm/v/@relative-ci/agent.svg)](https://www.npmjs.com/package/@relative-ci/agent)
[![node version](https://img.shields.io/node/v/@relative-ci/agent.svg)](https://www.npmjs.com/package/@relative-ci/agent)
[![ci](https://github.com/relative-ci/agent/actions/workflows/ci.yml/badge.svg)](https://github.com/relative-ci/agent/actions/workflows/ci.yml)
[![CodeQL](https://github.com/relative-ci/agent/actions/workflows/codeql.yml/badge.svg)](https://github.com/relative-ci/agent/actions/workflows/codeql.yml)

> Send bundle stats and CI build information to [RelativeCI](https://relative-ci.com?utm_source=github-agent).
Expand Down
25 changes: 25 additions & 0 deletions config/release-it-common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require('dotenv').config();

module.exports = {
git: {
commit: true,
// eslint-disable-next-line no-template-curly-in-string
commitMessage: ':package: release ${version}\n[ci skip]',
push: true,
requireUpstream: false,
tag: true,
// eslint-disable-next-line no-template-curly-in-string
tagName: 'v${version}',
},
npm: {
publish: false,
ignoreVersion: true,
allowSameVersion: true,
},
github: {
draft: false,
release: false,
preRelease: false,
tokenRef: 'GITHUB_TOKEN',
},
};
17 changes: 17 additions & 0 deletions config/release-it-publish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const config = require('./release-it-common');

module.exports = {
...config,
git: {
...config.git,
commit: false,
push: false,
tag: false,
requireCleanWorkingDir: false,
requireUpstream: false,
},
npm: {
...config.npm,
publish: true,
},
};
10 changes: 10 additions & 0 deletions config/release-it-version-beta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const config = require('./release-it-common');

module.exports = {
...config,
git: {
...config.git,
// eslint-disable-next-line no-template-curly-in-string
commitMessage: 'DROP - release ${version}',
},
};
20 changes: 20 additions & 0 deletions config/release-it-version-stable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const config = require('./release-it-common');

module.exports = {
...config,
git: {
...config.git,
// eslint-disable-next-line no-template-curly-in-string
commitMessage: ':package: release ${version}',
},
github: {
...config.github,
release: true,
},
plugins: {
...config.plugins,
'@release-it/conventional-changelog': {
preset: 'angular',
},
},
};
Loading

0 comments on commit 7c5e8a3

Please sign in to comment.