Skip to content

I changed nmber 99 in deploy step yaml file #23

I changed nmber 99 in deploy step yaml file

I changed nmber 99 in deploy step yaml file #23

Workflow file for this run

name: Node.js Package
on:
push:
branches:
- origin
jobs:
build:
name: build
if: github.ref == 'refs/heads/origin'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Greet User
run: echo "Welcome users!"
# Generate a random version number and assign it to APP_VERSION
- name: Assign Random Version
run:
echo APP_VERSION=$((RANDOM)) >> $GITHUB_ENV
- name: "Build the Docker Image"
env:
image_name: my-image
version: ${{ env.APP_VERSION }}
username: oluwaseun7
run: |
docker build -t $username/$image_name:$version .
- name: Create app_version.txt
run: |
echo "Version: ${{ env.APP_VERSION }}" > app_version.txt
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: app_version
path: app_version.txt
- name: Log into Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Send Email Notification
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: oluwaseun186
password: ${{ secrets.EMAIL_PASSWORD }}
subject: "GitHub Action Notification: New Commit to Main Branch"
body: |
A new commit has been pushed to the main branch.
Commit details:
- Commit message: ${{ github.event.head_commit.message }}
- Author: ${{ github.event.head_commit.author.name }}
- Commit URL: ${{ github.event.head_commit.url }}
to: "adewumibode7@gmail.com" # Replace with the recipient's email address
from: Mr Bode
secure: true
Deploy:
name: instance-deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Create app_version.txt
run: |
echo "Version: ${{ env.APP_VERSION }}" > app_version.txt
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: app_versio
path: app_version.txt
- name: Log into Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Run container from Docker Image
env:
image_name: app_test_image
version: 1.0.0
username: oluwaseun7
run: |
docker run -d -p 8080:80 $username/$image_name:$version
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Run test!
run: |
npm install
npm run test