Skip to content

Commit

Permalink
Merge pull request #1 from kirill-panoply/update-repository-setup
Browse files Browse the repository at this point in the history
[UM-730] Update repository setup
  • Loading branch information
kirill-panoply authored Sep 6, 2022
2 parents 10705ad + 0daea69 commit ea056d0
Show file tree
Hide file tree
Showing 8 changed files with 679 additions and 131 deletions.
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Description

- [List of all changes]

---

[Additional information about changes]

## Related PRs

- [List of related pull requests]

## Tasks

- [ ] [List of tasks that must be done before merging this pull request]
115 changes: 115 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: 🚀 CI/CD for Overflow

on:
push:
branches: [master]

pull_request:
branches: [master]

env:
node_version: 10.14

jobs:
check-version:
name: 🔍 Check version
runs-on: ubuntu-20.04
outputs:
version: ${{ steps.retrieve-version.outputs.version }}
steps:
- name: 🐙 Checkout repository
uses: actions/checkout@v3

- name: 📝 Retrieve version
id: retrieve-version
run: |
echo "::set-output name=version::$(jq -r .version package.json)"
- name: 🔍 Check git tag availability
run: |
! git ls-remote --exit-code --tags origin v${{ steps.retrieve-version.outputs.version }}
run-tests:
name: 🧪 Run tests
runs-on: ubuntu-20.04
steps:
- name: 🐙 Checkout repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: 🔧 Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
cache: npm

- name: 📦 Install dependencies
run: |
npm ci
- name: 🧪 Run tests
run: |
npm test
create-release:
name: 🎉 Create release
needs: [check-version, run-tests]
if: github.event_name == 'push'
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: 🎉 Create release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.check-version.outputs.version }}
target_commitish: ${{ github.sha }}

send-notifications:
name: 🔔 Send notifications
needs: [check-version, run-tests, create-release]
if: github.event_name == 'push' && always()
runs-on: ubuntu-20.04
steps:
- name: 📝 Retrieve workflow result
id: retrieve-workflow-result
run: |
if [ ${{ needs.check-version.result }} = 'success' ] \
&& [ ${{ needs.run-tests.result }} = 'success' ] \
&& [ ${{ needs.create-release.result }} = 'success' ]
then
echo "::set-output name=result::success"
echo "::set-output name=message::succeeded"
elif [ ${{ needs.check-version.result }} = 'cancelled' ] \
|| [ ${{ needs.run-tests.result }} = 'cancelled' ] \
|| [ ${{ needs.create-release.result }} = 'cancelled' ]
then
echo "::set-output name=result::cancelled"
echo "::set-output name=message::canceled"
else
echo "::set-output name=result::failure"
echo "::set-output name=message::failed"
fi
- name: 📝 Retrieve origin url message
id: retrieve-origin-url-message
run: |
echo "::set-output name=message::<https://github.com/${{ github.repository }}/commit/${{ github.sha }}|$(echo ${{ github.sha }} | cut -c1-9)>"
- name: 🔔 Send Slack notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: ' '
SLACK_COLOR: ${{ steps.retrieve-workflow-result.outputs.result }}
SLACK_MESSAGE: >-
<https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|Workflow>
of ${{ steps.retrieve-origin-url-message.outputs.message }}
on <https://github.com/${{ github.repository }}/tree/v${{ needs.check-version.outputs.version }}|${{ github.repository }}@v${{ needs.check-version.outputs.version }}>
by ${{ github.actor }}
${{ steps.retrieve-workflow-result.outputs.message }}
SLACK_MSG_AUTHOR: ' '
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_FOOTER: ' '
MSG_MINIMAL: true
Loading

0 comments on commit ea056d0

Please sign in to comment.