Skip to content

4-githubcomfarahmandakbar26https #54

Description

@farahmandakbar26

پرش به محتوا

کد
مسائل
بیشتر
پودرهای سوخاریnodejs/ .github/ گردش کار
/
azure-webapps-node.yml
که در
اصلی

ویرایش کنید

پیش نمایش
حالت تورفتگی

فضاها
اندازه تورفتگی

2
حالت بسته بندی خط

بدون بسته بندی
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

This workflow will build and push a node.js application to an Azure Web App when a commit is pushed to your default branch.

This workflow assumes you have already created the target Azure App Service web app.

For instructions see https://docs.microsoft.com/en-us/azure/app-service/quickstart-nodejs?tabs=linux&pivots=development-environment-cli

To configure this workflow:

1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal.

For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials

2. Create a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE, paste the publish profile contents as the value of the secret.

For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret

3. Change the value for the AZURE_WEBAPP_NAME. Optionally, change the AZURE_WEBAPP_PACKAGE_PATH and NODE_VERSION environment variables below.

For more information on GitHub Actions for Azure: https://github.com/Azure/Actions

For more information on the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy

For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples

on:
push:
branches: [ "main" ]
workflow_dispatch:

env:
AZURE_WEBAPP_NAME: your-app-name # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
NODE_VERSION: '14.x' # set this to the node version to use

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: npm install, build, and test
  run: |
    npm install
    npm run build --if-present
    npm run test --if-present

- name: Upload artifact for deployment job
  uses: actions/upload-artifact@v3
  with:
    name: node-app
    path: .

deploy:
permissions:
contents: none
runs-on: ubuntu-latest
needs: build
Control + Shift + mبرای تغییر دادن فوکوس متحرک کلید استفاده کنید tab. از طرف دیگر، escاز سپس tabبرای رفتن به عنصر تعاملی بعدی در صفحه استفاده کنید.
Control + Space برای راه اندازی تکمیل خودکار در اکثر شرایط استفاده کنید .
فایل جدید در / · farahmandakbar26/nodejs
پیمایش پانل راهنما
بازار
مستندات
شروع کار با گردش کار
برای کمک به شما برای شروع، این راهنما چند مثال اساسی را به شما نشان می دهد. برای مستندات کامل GitHub Actions در مورد گردش کار، به " پیکربندی گردش کار " مراجعه کنید.

سفارشی کردن زمانی که جریان کار راه اندازی می شود
گردش کار خود را طوری تنظیم کنید که روی رویدادهای فشاری به شاخه ها mainو اجرا شودrelease/*

on:
push:
branches:
- main
- release/*
گردش کار خود را طوری تنظیم کنید که روی pull_requestرویدادهایی اجرا شود که mainشعبه را هدف قرار می دهند

on:
pull_request:
branches:
- main
گردش کار خود را طوری تنظیم کنید که هر روز هفته از دوشنبه تا جمعه ساعت 2:00 UTC اجرا شود

on:
schedule:

  • cron: "0 2 * * 1-5"
    برای اطلاعات بیشتر، به " رویدادهایی که گردش کار را راه اندازی می کنند " مراجعه کنید.

اجرای دستی یک گردش کار
برای اجرای دستی یک گردش کار، می توانید گردش کار خود را برای استفاده از workflow_dispatchرویداد پیکربندی کنید. این دکمه "Run Workflow" را در تب Actions فعال می کند.

on:
workflow_dispatch:
برای اطلاعات بیشتر، به " اجرای دستی گردش کار " مراجعه کنید.

کارهای خود را بر روی سیستم عامل های مختلف اجرا کنید
GitHub Actions اجراهای میزبانی شده را برای لینوکس، ویندوز و macOS فراهم می کند.

برای تنظیم سیستم عامل برای کار خود، سیستم عامل را با استفاده از runs-on:

jobs:
my_job:
name: deploy to staging
runs-on: ubuntu-18.04
انواع ماشین مجازی موجود عبارتند از:

ubuntu-latest، ubuntu-18.04، یاubuntu-16.04
windows-latestیاwindows-2019
macos-latestیاmacos-10.15
برای اطلاعات بیشتر، به « محیط‌های مجازی برای اقدامات GitHub » مراجعه کنید.

با استفاده از یک عمل
Actions واحدهای کد قابل استفاده مجدد هستند که می توانند توسط هر کسی در GitHub ساخته و توزیع شوند. می‌توانید انواع اکشن‌ها را در بازار GitHub و همچنین در مخزن رسمی Actions پیدا کنید .

برای استفاده از یک اقدام، باید مخزن حاوی اکشن را مشخص کنید. همچنین توصیه می کنیم برای اطمینان از اینکه از نسخه منتشر شده اکشن استفاده می کنید، یک تگ Git را مشخص کنید.

  • name: Setup Node
    uses: actions/setup-node@v1
    with:
    node-version: '10.x'
    برای اطلاعات بیشتر، به " نحو گردش کار برای اقدامات GitHub ."

اجرای یک فرمان
می توانید دستورات را روی ماشین مجازی کار اجرا کنید.

  • name: Install Dependencies
    run: npm install
    برای اطلاعات بیشتر، به " نحو گردش کار برای اقدامات GitHub ."

اجرای یک کار در ماتریسی از سیستم عامل ها و نسخه های زمان اجرا
شما می توانید به طور خودکار یک کار را در مجموعه ای از مقادیر مختلف اجرا کنید، مانند نسخه های مختلف کتابخانه های کد یا سیستم عامل.

به عنوان مثال، این کار از یک استراتژی ماتریسی برای اجرا در 3 نسخه Node و 3 سیستم عامل استفاده می کند:

jobs:
test:
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node_version: ['8', '10', '12']
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node_version }}
  uses: actions/setup-node@v1
  with:
    node-version: ${{ matrix.node_version }}

- name: npm install, build and test
  run: |
    npm install
    npm run build --if-present
    npm test

برای اطلاعات بیشتر، به " نحو گردش کار برای اقدامات GitHub ."

اجرای مراحل یا کارهای مشروط
GitHub Actions از شرایط مربوط به مراحل و مشاغل با استفاده از داده های موجود در زمینه گردش کار شما پشتیبانی می کند.

به عنوان مثال، برای اجرای یک مرحله فقط به عنوان بخشی از یک فشار و نه در یک pull_request، می توانید یک شرط را در ویژگی if:بر اساس نام رویداد مشخص کنید:

steps:

  • run: npm publish
    if: github.event_name == 'push'
    برای اطلاعات بیشتر، به « متن و نحو عبارت برای اقدامات GitHub » مراجعه کنید.
    github.com/farahmandakbar26/HTTPS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions