-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Veeti Laine
committed
Jul 11, 2024
1 parent
3496500
commit da4d78c
Showing
1 changed file
with
63 additions
and
0 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,63 @@ | ||
name: Deployment pipeline | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: [opened, synchronize] | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
COMMIT_MESSAGES: ${{ toJson(github.event.commits.*.message) }} | ||
COMMIT: ${{ toJson(github.event.commits)[0] }} | ||
|
||
jobs: | ||
simple_deployment_pipeline: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- run: npm install | ||
- run: npm run eslint | ||
- run: npm run build | ||
- run: npm run test | ||
- name: e2e tests | ||
uses: cypress-io/github-action@v5 | ||
with: | ||
command: cd frontend && npm run cypress | ||
start: npm run start | ||
wait-on: http://localhost:5000 | ||
- name: deployment | ||
if: ${{ github.event_name == 'push' }} | ||
run: curl https://api.render.com/deploy/srv-${{ secrets.RENDER_SERVICE_ID }}?key=${{ secrets.RENDER_API_KEY }} | ||
- name: Success | ||
uses: rjstone/discord-webhook-notify@v1 | ||
if: ${{ github.event_name == 'push' && success() }} | ||
with: | ||
severity: info | ||
text: A new version of Bloglist App deployed | ||
details: 'to https://full-stack-open-pokedex-pupa.onrender.com/' | ||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} | ||
- name: Failure | ||
uses: rjstone/discord-webhook-notify@v1 | ||
if: ${{ github.event_name == 'push' && failure() }} | ||
with: | ||
severity: error | ||
text: Build failed! | ||
details: ${{ format('commit {0} by {1} broke the build :((', env.COMMIT.url, env.COMMIT.author.name) }} | ||
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} | ||
tag_release: | ||
needs: [simple_deployment_pipeline] | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Bump version and push tag | ||
if: ${{ github.event_name == 'push' && !contains(join(env.COMMIT_MESSAGES, ', '), '#skip')}} | ||
uses: anothrNick/github-tag-action@8c8163ef62cf9c4677c8e800f36270af27930f42 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DEFAULT_BUMP: patch |