Merge pull request #418 from qoretechnologies/bugfix/switch-revert-size #313
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Beta release | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the develop branch | |
on: | |
push: | |
branches: | |
- develop | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
Publish-and-release: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Get current time | |
uses: josStorer/get-current-time@v2.0.2 | |
id: current_time | |
with: | |
format: YYYYMMDD-HH | |
utcOffset: '+01:00' | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
# Checkout the repo | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
# Get commit message | |
- name: Print head git commit message | |
id: get_head_commit_message | |
run: echo "::set-output name=HEAD_COMMIT_MESSAGE::$(git show -s --format=%s)" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Save release version to outputs | |
id: save_release_version | |
run: echo ::set-output name=version::$(node -pe "require('./package.json').version") | |
- name: Preparing environment | |
id: setup_environment | |
run: npm install -g yarn | |
- name: Installing modules | |
id: install_modules | |
run: | | |
yarn cache clean | |
rm -rf node_modules | |
yarn install | |
- name: Running tests | |
id: tests | |
run: yarn test:ci | |
- name: Build | |
id: build | |
run: yarn build | |
- name: Publish to NPM | |
id: npm_publish | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
tag: beta | |
access: public | |
- name: Publish to Chromatic | |
id: chromatic_publish | |
uses: chromaui/action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
- name: Create a release | |
id: release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.save_release_version.outputs.version }} | |
release_name: v${{ steps.save_release_version.outputs.version }} | |
body: v${{ steps.save_release_version.outputs.version }} | |
draft: false | |
prerelease: false | |
# Notify discord if success | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{secrets.DISCORD_WEBHOOK}} | |
DISCORD_EMBEDS: '[{"author": {"icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "https://github.com/${{github.actor}}"}, "url": "https://github.com/${{github.repository}}/commit/${{github.sha}}", "fields": [{ "name": "Commit Message", "value": "${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}"},{"name": "Repository","value": "[${{github.event.repository.name}}](${{github.event.repository.clone_url}})","inline": true},{"name": "Branch","value": "[${{github.ref_name}}](https://github.com/${{github.repository}}/pull/${{github.ref_name}})","inline": true},{ "name": "Event", "value": "${{github.event_name}}", "inline": true },{"name": "Author","value": "[${{github.actor}}](https://github.com/${{github.actor}})","inline": true},{ "name": "Job", "value": "${{github.job}}", "inline": true },{ "name": "Version", "value": "v${{ steps.save_release_version.outputs.version }}", "inline": true},{"name": "","value": "🤖 [Github Action](https://github.com/${{ github.repository}}/actions/runs/${{ github.run_id}}) 📙 [Documentation](${{ steps.chromatic_publish.outputs.storybookUrl }}) 🎨 [Chromatic Tests](${{ steps.chromatic_publish.outputs.buildUrl }})"}],"color": 65280,"footer": { "text": "Published at ${{steps.current_time.outputs.readableTime}}" }}]' | |
DISCORD_AVATAR: 'https://github.com/qoretechnologies/reqore/blob/ae8ce24b7f0984340bf4e6835025d203d1741b3a/public/q-symbol-small.png?raw=true' | |
uses: Ilshidur/action-discord@0.3.2 | |
with: | |
args: ':white_check_mark: ReQore beta v${{ steps.save_release_version.outputs.version }} successfuly released & published.' | |
if: success() | |
# Notify discord if failure | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{secrets.DISCORD_WEBHOOK}} | |
DISCORD_EMBEDS: '[{"author": {"icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "https://github.com/${{github.actor}}"}, "url": "https://github.com/${{github.repository}}/commit/${{github.sha}}", "fields": [{ "name": "Commit Message", "value": "${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}"},{"name": "Repository","value": "[${{github.event.repository.name}}](${{github.event.repository.clone_url}})","inline": true},{"name": "Branch","value": "[${{github.ref_name}}](https://github.com/${{github.repository}}/pull/${{github.ref_name}})","inline": true},{ "name": "Event", "value": "${{github.event_name}}", "inline": true },{"name": "Author","value": "[${{github.actor}}](https://github.com/${{github.actor}})","inline": true},{ "name": "Job", "value": "${{github.job}}", "inline": true },{ "name": "Version", "value": "v${{ steps.save_release_version.outputs.version }}", "inline": true},{"name": "","value": "🤖 [Github Action](https://github.com/${{ github.repository}}/actions/runs/${{ github.run_id}})"}],"color": 16711680,"footer": { "text": "Triggered at ${{steps.current_time.outputs.readableTime}}" }}]' | |
DISCORD_AVATAR: 'https://github.com/qoretechnologies/reqore/blob/ae8ce24b7f0984340bf4e6835025d203d1741b3a/public/q-symbol-small.png?raw=true' | |
uses: Ilshidur/action-discord@0.3.2 | |
with: | |
args: ':exclamation: ReQore beta v${{ steps.save_release_version.outputs.version }} release failed! Click the GitHub Action link below to find out why.' | |
if: failure() |