Skip to content

Commit

Permalink
ci: release alpha version on every push to main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopf authored Feb 3, 2022
1 parent 40ce384 commit f86e0b3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 17 deletions.
25 changes: 25 additions & 0 deletions .github/actions/release-alpha/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Release alpha version
description: Runs npm script to release alpha version and pushes tags to github
inputs:
npm-token:
description: Token to push code with
required: true
runs:
using: "composite"
steps:
- name: Configure git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "empathy/x"
shell: bash
- name: Create .npmrc file with authorization token
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
shell: bash
env:
NPM_TOKEN: ${{ inputs.npm-token }}
- name: Publish release
run: npm run release:alpha
shell: bash
- name: Push changes to GitHub
run: git push --follow-tags
shell: bash
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
name: Check branch is releasable
name: Check branch is releasable and release alpha on main branch update
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
container: cypress/browsers:node14.17.0-chrome91-ff89
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.SUPPORT_TOKEN }}
- name: Install lerna and all packages
run: npm ci
- name: Run linter in all packages
run: npm run lint
- name: Run tests in all packages
run: npm run test
- name: Release alpha on non-release pushes to main branch
if: ${{ github.ref_name == 'main' && github.actor != 'support-empathy' && !startsWith(github.event.head_commit.message, 'chore(release):') }}
uses: ./.github/actions/release-alpha
with:
npm-token: ${{ secrets.NPM_TOKEN }}

18 changes: 5 additions & 13 deletions .github/workflows/release-alpha.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release alpha version
name: Release alpha version on demand
on: [workflow_dispatch]
jobs:
release-alpha:
Expand All @@ -15,15 +15,7 @@ jobs:
run: npm run lint
- name: Run tests in all packages
run: npm run test
- name: Configure git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "empathy/x"
- name: Create .npmrc file with authorization token
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish release
run: npm run release:alpha
- name: Push changes to GitHub
run: git push --follow-tags
- name: Call release alpha action
uses: ./.github/actions/release-alpha
with:
npm-token: ${{ secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"command": {
"bootstrap": {
"npmClientArgs": ["--legacy-peer-deps"]
},
"version": {
"message": "chore(release): publish"
}
}
}
4 changes: 1 addition & 3 deletions packages/x-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
"test:e2e:ci": "vue-cli-service test:e2e --headless --browser chrome",
"test": "npm run test:unit && npm run test:e2e:ci",
"cypress:open": "cypress open",
"cypress:open:component": "cypress open-ct",
"release": "standard-version --no-verify",
"release:alpha": "standard-version --no-verify --prerelease alpha"
"cypress:open:component": "cypress open-ct"
},
"dependencies": {
"@empathyco/x-adapter": "^7.0.0-alpha.9",
Expand Down

0 comments on commit f86e0b3

Please sign in to comment.