forked from avinoamr/overflow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from kirill-panoply/update-repository-setup
[UM-730] Update repository setup
- Loading branch information
Showing
8 changed files
with
679 additions
and
131 deletions.
There are no files selected for viewing
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
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] |
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
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 |
Oops, something went wrong.