Skip to content

Commit

Permalink
feat: add intitial versioning (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Dec 14, 2021
1 parent 468783e commit 4f1acca
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 31 deletions.
18 changes: 18 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: build
description: installs dependencies & generates a build

runs:
using: 'composite'
steps:
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: install
run: npm ci
shell: bash

- name: build
run: npm run build
shell: bash
11 changes: 1 addition & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: install
run: npm ci

- name: prepare env
run: cp ${ENV:-'.github/.env.staging'} .env

- name: build
run: npm run build
- uses: ./.github/actions/build

- name: pinata
id: pinata
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/deploy_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: install
run: npm ci

- name: prepare env
run: cp ${ENV:-'.github/.env.production'} .env

- name: build
run: npm run build
- uses: ./.github/actions/build

- name: pinata
id: pinata
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Draft release

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: setup config
run: |
git config --global user.email "[email protected]"
git config --global user.name "Release bot :robot:"
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: install
run: npm i -g standard-version

# this ci will just generate the changelog in a pr
- name: release
run: |
standard-version --message "chore(release): Release v%s :rocket: :tada:" --skip.tag
git checkout -b release/${{ github.sha }}
git push origin release/${{ github.sha }}
- name: version
id: version
run: echo ::set-output name=VERSION::$(node -pe "require('./package.json').version")

- uses: actions/github-script@v5
with:
script: |
github.rest.pulls.create({
title: 'Release ${{ steps.version.outputs.VERSION }} :rocket: :tada:',
body: 'Please review and refine the changelog carefully, before approving this pr.',
owner: context.repo.owner,
repo: context.repo.repo,
head: 'release/${{ github.sha }}',
base: 'master'
})
11 changes: 1 addition & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'

- name: install
run: npm ci

- name: prepare env
run: cp ${ENV:-'.github/.env.preview'} .env

- name: build
run: npm run build
- uses: ./.github/actions/build

- name: pinata
id: pinata
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release

concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- id: tag
name: tag
if: |
github.ref == 'refs/heads/master' &&
contains(github.event.head_commit.message, 'chore(release)')
run: |
git tag v$(node -pe "require('./package.json').version")
git push origin v$(node -pe "require('./package.json').version")
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ web-report/
.vscode
yarn-error.log
dist/
build/
/build
.idea
web-build
yalc.lock
Expand Down

0 comments on commit 4f1acca

Please sign in to comment.