formatted workflows

هذا الالتزام موجود في:
Chris Ayers
2023-10-01 23:00:42 +00:00
الأصل d05871b323
التزام 7720922c15
19 ملفات معدلة مع 136 إضافات و143 حذوفات

عرض الملف

@@ -17,10 +17,11 @@ on:
paths: paths:
- '**.js' - '**.js'
pull_request: pull_request:
branches: [ main ] branches: [main]
# schedule: # schedule:
# * is a special character in YAML so you have to quote this string # * is a special character in YAML so you have to quote this string
# - cron: '30 5,17 * * *' # - cron: '30 5,17 * * *'
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:

عرض الملف

@@ -6,9 +6,9 @@ name: 01 Basic Workflow with Multiple Jobs
on: on:
# Triggers the workflow on push or pull request events but only for the main branch # Triggers the workflow on push or pull request events but only for the main branch
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:

عرض الملف

@@ -6,9 +6,9 @@ name: 02 Basic Dependencies
on: on:
# Triggers the workflow on push or pull request events but only for the main branch # Triggers the workflow on push or pull request events but only for the main branch
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
@@ -27,7 +27,7 @@ jobs:
job2: job2:
# The type of runner that the job will run on # The type of runner that the job will run on
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ job1 ] needs: [job1]
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:
# Runs a single command using the runners shell # Runs a single command using the runners shell
@@ -36,7 +36,7 @@ jobs:
job3: job3:
# The type of runner that the job will run on # The type of runner that the job will run on
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ job2 ] needs: [job2]
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:

عرض الملف

@@ -6,9 +6,9 @@ name: 03 Steps
on: on:
# Triggers the workflow on push or pull request events but only for the main branch # Triggers the workflow on push or pull request events but only for the main branch
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
@@ -57,4 +57,3 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# Reference a branch # Reference a branch
- uses: actions/checkout@main - uses: actions/checkout@main

عرض الملف

@@ -6,9 +6,9 @@ name: 04 Variables
on: on:
# Triggers the workflow on push or pull request events but only for the main branch # Triggers the workflow on push or pull request events but only for the main branch
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:

عرض الملف

@@ -6,9 +6,9 @@ name: 04 Variable Hierarchy
on: on:
# Triggers the workflow on push or pull request events but only for the main branch # Triggers the workflow on push or pull request events but only for the main branch
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:

عرض الملف

@@ -6,9 +6,9 @@ name: 05 Conditionals
on: on:
# Triggers the workflow on push or pull request events but only for the main branch # Triggers the workflow on push or pull request events but only for the main branch
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:

عرض الملف

@@ -7,9 +7,9 @@ name: 06 Expressions
on: on:
# Triggers the workflow on push or pull request events but only for the main branch # Triggers the workflow on push or pull request events but only for the main branch
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:

عرض الملف

@@ -26,4 +26,3 @@ jobs:
uses: actions/hello-world-javascript-action@main uses: actions/hello-world-javascript-action@main
with: with:
who-to-greet: ${{ vars.GREET_NAME }} who-to-greet: ${{ vars.GREET_NAME }}

عرض الملف

@@ -6,9 +6,9 @@ name: 08 Secrets
on: on:
# Triggers the workflow on push or pull request events but only for the main branch # Triggers the workflow on push or pull request events but only for the main branch
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
@@ -49,6 +49,4 @@ jobs:
- name: Parse Structured Objects - name: Parse Structured Objects
run: echo "$Structured" run: echo "$Structured"
env: env:
Structured: ${{fromJson(secrets.Structured).clientSecret}} Structured: ${{fromJson(secrets.Structured).clientSecret}}

عرض الملف

@@ -6,11 +6,11 @@ name: 09 Node.js Matrix
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: [ main ] branches: [main]
paths: paths:
- 'node-example/**' - 'node-example/**'
pull_request: pull_request:
branches: [ main ] branches: [main]
paths: paths:
- 'node-example/**' - 'node-example/**'
@@ -20,18 +20,17 @@ defaults:
jobs: jobs:
build-node: build-node:
strategy: strategy:
matrix: matrix:
node-version: [12.x, 14.x, 16.x] node-version: [12.x, 14.x, 16.x]
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: npm ci - run: npm ci
- run: npm run build --if-present - run: npm run build --if-present
- run: npm test - run: npm test

عرض الملف

@@ -3,12 +3,12 @@ name: 10 .NET
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: [ main ] branches: [main]
paths: paths:
- '!**' - '!**'
- 'dotnet-sample/**' - 'dotnet-sample/**'
pull_request: pull_request:
branches: [ main ] branches: [main]
paths: paths:
- '!**' - '!**'
- 'dotnet-sample/**' - 'dotnet-sample/**'
@@ -23,44 +23,43 @@ defaults:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: 7.0.x dotnet-version: 7.0.x
- name: Set up dependency caching for faster builds - name: Set up dependency caching for faster builds
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.nuget/packages path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-nuget- ${{ runner.os }}-nuget-
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore run: dotnet restore
- name: Build - name: Build
run: dotnet build --configuration Release --no-restore run: dotnet build --configuration Release --no-restore
- name: Test - name: Test
run: dotnet test --no-build --verbosity normal run: dotnet test --no-build --verbosity normal
- name: dotnet publish - name: dotnet publish
run: dotnet publish -c Release -o ./webapp run: dotnet publish -c Release -o ./webapp
- name: Upload artifact for deployment job - name: Upload artifact for deployment job
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: webapp name: webapp
path: ./dotnet-sample/webapp path: ./dotnet-sample/webapp
- name: Upload artifact for deployment job - name: Upload artifact for deployment job
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: iac name: iac
path: ./dotnet-sample/iac path: ./dotnet-sample/iac
deploy-webapp: deploy-webapp:
needs: [build] needs: [build]
@@ -68,39 +67,38 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# Checkout code # Checkout code
- name: Download IaC - name: Download IaC
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: iac name: iac
path: iac path: iac
# Log into Azure # Log into Azure
- uses: azure/login@v1 - uses: azure/login@v1
name: Sign in to Azure name: Sign in to Azure
with: with:
client-id: ${{ secrets.AZURE_CLIENT_ID }} client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# Deploy Bicep file # Deploy Bicep file
- name: deploy - name: deploy
id: deploy id: deploy
uses: azure/arm-deploy@v1 uses: azure/arm-deploy@v1
with: with:
resourceGroupName: ${{ secrets.AZURE_RG }} resourceGroupName: ${{ secrets.AZURE_RG }}
template: ./iac/main.bicep template: ./iac/main.bicep
parameters: webAppName=${{ secrets.AZURE_APP_NAME }} parameters: webAppName=${{ secrets.AZURE_APP_NAME }}
failOnStdErr: false failOnStdErr: false
- name: Download App - name: Download App
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: webapp name: webapp
path: webapp path: webapp
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ steps.deploy.outputs.webAppName }} # Replace with your app name
package: 'webapp'
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ steps.deploy.outputs.webAppName }} # Replace with your app name
package: 'webapp'

عرض الملف

@@ -3,11 +3,11 @@ name: Docker Image CI
on: on:
workflow_dispatch: workflow_dispatch:
push: push:
branches: [ main ] branches: [main]
paths: paths:
- 'container-example/**' - 'container-example/**'
pull_request: pull_request:
branches: [ main ] branches: [main]
paths: paths:
- 'container-example/**' - 'container-example/**'
@@ -16,23 +16,22 @@ defaults:
working-directory: containers-example working-directory: containers-example
jobs: jobs:
build: build:
environment: docker environment: docker
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }} password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: container-example context: container-example
push: true push: true
tags: | tags: |
${{ secrets.DOCKER_USERNAME }}/static-site:latest ${{ secrets.DOCKER_USERNAME }}/static-site:latest
${{ secrets.DOCKER_USERNAME }}/static-site:${{ github.sha }} ${{ secrets.DOCKER_USERNAME }}/static-site:${{ github.sha }}

عرض الملف

@@ -8,8 +8,8 @@ jobs:
name: Lint code name: Lint code
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Lint code - name: Lint code
run: | run: |
az bicep build --file bicep/main.bicep az bicep build --file bicep/main.bicep

عرض الملف

@@ -3,7 +3,7 @@ name: Deploy marp site to Pages
on: on:
# Runs on pushes targeting the default branch # Runs on pushes targeting the default branch
push: push:
branches: ["main"] branches: ['main']
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
@@ -17,7 +17,7 @@ permissions:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency: concurrency:
group: "pages" group: 'pages'
cancel-in-progress: false cancel-in-progress: false
jobs: jobs:
@@ -30,7 +30,7 @@ jobs:
run: mkdir build && cp -R slides/img build/img && cp -R slides/themes build/themes run: mkdir build && cp -R slides/img build/img && cp -R slides/themes build/themes
- name: Marp Build (README) - name: Marp Build (README)
uses: docker://marpteam/marp-cli:v2.5.0 uses: docker://marpteam/marp-cli:latest
with: with:
args: --theme-set slides/themes -o build/index.html --html -- slides/Slides.md args: --theme-set slides/themes -o build/index.html --html -- slides/Slides.md
env: env:

عرض الملف

@@ -8,9 +8,9 @@ name: Lint Code Base
on: on:
push: push:
branches: [ main ] branches: [main]
pull_request: pull_request:
branches: [ main ] branches: [main]
jobs: jobs:
run-lint: run-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest