Skip to content

PR #20

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open

PR #20

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
87c929a
Dockerfile added
awameg Jul 11, 2022
c3205a4
Create node.js.yml
awameg Jul 11, 2022
ac9e152
Delete .github/workflows directory
awameg Jul 11, 2022
2a56694
Dockerfile added
awameg Jul 11, 2022
80a01d1
Merge branch 'master' of github.com:awameg/angular-react-starter
awameg Jul 11, 2022
361af28
Update build.yml
awameg Jul 11, 2022
1baa242
Update build.yml
awameg Jul 11, 2022
a108478
Update build.yml
awameg Jul 12, 2022
9ba502c
Update build.yml
awameg Jul 12, 2022
9c2e830
Update build.yml
awameg Jul 12, 2022
5f7e1d4
Update build.yml
awameg Jul 12, 2022
8edbddb
Update build.yml
awameg Jul 12, 2022
0555992
Update build.yml
awameg Jul 12, 2022
92459f2
Update build.yml
awameg Jul 12, 2022
065cf96
Update build.yml
awameg Jul 12, 2022
d877d1f
Update build.yml
awameg Jul 12, 2022
0d4f965
Update build.yml
awameg Jul 12, 2022
6ef33df
Update build.yml
awameg Jul 12, 2022
0d24d8f
Update build.yml
awameg Jul 12, 2022
9265f76
Update build.yml
awameg Jul 12, 2022
6ca0851
Update build.yml
awameg Jul 12, 2022
acf289e
Update build.yml
awameg Jul 12, 2022
0269efc
Update build.yml
awameg Jul 12, 2022
b30dd62
Update build.yml
awameg Jul 12, 2022
d62d3a2
Update build.yml
awameg Jul 12, 2022
e9ad7f5
Update build.yml
awameg Jul 12, 2022
df76851
docker build added
awameg Jul 12, 2022
224fdbc
Update build.yml
awameg Jul 12, 2022
98a4d97
dockerfile change user to nginx
awameg Jul 12, 2022
c44b3f4
Notification added
awameg Jul 12, 2022
961209e
test
awameg Jul 12, 2022
4a92418
Update build.yml
awameg Jul 12, 2022
27e0663
Update build.yml
awameg Jul 12, 2022
1ef9a8d
Update build.yml
awameg Jul 12, 2022
1f19f43
Update build.yml
awameg Jul 12, 2022
d53baf3
Notification changed
awameg Jul 12, 2022
3203eb5
Update build.yml
awameg Jul 13, 2022
73a22d1
Get npm version added
awameg Jul 13, 2022
f2b978f
Without specifying the version
awameg Jul 13, 2022
f3cf236
Fail check step added
awameg Jul 13, 2022
43f1731
Execution time added to notification
awameg Jul 13, 2022
51832bf
Execution time added to notification
awameg Jul 13, 2022
de93d58
Update build.yml
awameg Jul 13, 2022
d1d945c
Update build.yml
awameg Jul 13, 2022
d243195
Update build.yml
awameg Jul 13, 2022
d78032f
Update build.yml
awameg Jul 13, 2022
e5f8240
Update build.yml
awameg Jul 13, 2022
9110232
Update build.yml
awameg Jul 13, 2022
a13a9f5
Update build.yml
awameg Jul 13, 2022
52722e1
Update build.yml
awameg Jul 13, 2022
be76232
Update build.yml
awameg Jul 13, 2022
cdd2298
Notification fix bug
awameg Jul 14, 2022
958dd32
Get public email added to notification
awameg Jul 14, 2022
de3d097
Fix run tests
awameg Jul 14, 2022
68a4e70
Added stop pipeline
awameg Jul 14, 2022
72d40be
Delete package-lock.json
awameg Jul 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build
env:
GH_TOKEN: ${{ secrets.token }}
on:
push:
branches: master
pull_request:
branches: master

jobs:
## Main job
build:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v3
# Setup environment
- name: Setup node
uses: actions/setup-node@v3
with:
cache-dependency-path: angular/package-lock.json

# Installing dependencies
- name: Installing dependencies
run: cd ${{ github.workspace }}/angular && npm install

# Run tests
- name: test
id: test
uses: GabrielBB/xvfb-action@v1
with:
run: cd ${{ github.workspace }}/angular && npm run test

- name: Pass or fail
if: failure()
run: exit 1

# Build app
- name: build app
run: cd ${{ github.workspace }}/angular && npm run build

# Build docker image
- name: docker image build
run: docker build -t ghcr.io/awameg/nginx-angular:latest -t ghcr.io/awameg/nginx-angular:${GITHUB_SHA::8} .

- name: docker login
run: docker login ghcr.io -u $GITHUB_ACTOR -p ${{secrets.GITHUB_TOKEN}}

- name: Publish docker image
run: docker push ghcr.io/awameg/nginx-angular:latest && docker push ghcr.io/awameg/nginx-angular:${GITHUB_SHA::8}

## Notification job - it starts after the main
notification:
runs-on: ubuntu-latest
needs: [build]

steps:
- name: Check out repository code
uses: actions/checkout@v3

# Get email from git log
- name: get email
id: get-email
run: echo "::set-output name=email::$(git log -n 1 --pretty=format:%ae)"

# Get execution time for notification
- name: get time
id: get-time
run: echo "::set-output name=time::$(gh run list --workflow build.yml | head -n 1 | awk -F'\t' '{print $8}')"

# Notifications
- name: Send mail success
if: success()
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.yandex.ru
server_port: 465
username: ${{ secrets.EMAIL_NOTIFY }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
body: "${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}. \nExecution time: ${{ steps.get-time.outputs.time }}"
to: ${{ steps.get-email.outputs.email }}
from: GitHub ${{ github.repository }}

- name: Send mail failure
if: failure()
uses: dawidd6/action-send-mail@v2
with:
server_address: smtp.yandex.ru
server_port: 465
username: ${{ secrets.EMAIL_NOTIFY }}
password: ${{ secrets.EMAIL_PASSWORD }}
subject: ${{ github.job }} job of ${{ github.repository }} has FAILED!!!
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has FAILED!!!
to: ${{ steps.get-email.outputs.email }}
from: GitHub ${{ github.repository }}
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
/.angular

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM nginx:1.22.0-alpine
WORKDIR /app
COPY /angular/dist/angular-starter/ /app
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid /app
USER nginx
3 changes: 2 additions & 1 deletion angular/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
}
},
"cli": {
"defaultCollection": "@angular-eslint/schematics"
"defaultCollection": "@angular-eslint/schematics",
"analytics": "3776b823-e9c1-428b-adca-9f0b607ba56c"
}
}
Loading