Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
10 changes: 9 additions & 1 deletion .github/actions/hello-world-composite-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@ runs:
run: echo "random-id=$(echo $RANDOM)" >> $GITHUB_OUTPUT
shell: bash
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
shell: bash
shell: bash
- name: Hello world
uses: actions/hello-world-javascript-action@main
with:
who-to-greet: "${{ inputs.who-to-greet }}"
id: hello
- name: Echo the greeting's time
run: echo 'The time was ${{ steps.hello.outputs.time }}.'
shell: bash
10 changes: 6 additions & 4 deletions .github/workflows/cd-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: 07-2. CD Workflow

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

env:
AZURE_WEBAPP_NAME: your-app-name # set this to your application's name
Expand Down Expand Up @@ -51,7 +50,10 @@ jobs:
steps:

# Add here the download-artifact step

- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app

- name: Deploy to Prod
if: ${{ success() }}
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
fail-fast: true
matrix:
# our matrix for testing across node versions and OSs
node-version: [12, 14]
os: [windows-2019, ubuntu-20.04, ubuntu-22.04]
node-version: [12, 14, 16]
os: [macos-latest, windows-latest, ubuntu-latest]

steps:
- name: Checkout
Expand All @@ -43,7 +43,14 @@ jobs:
echo npm test

# Add here the upload-artifact action

- shell: bash
run: |
echo 'Test upload artifact' > output.log
- name: Upload output file
uses: actions/upload-artifact@v4
with:
name: output-log-file
path: output.log

# If both linting and CI succeeds we want to deploy the code to a test environment
deploy-test:
Expand All @@ -58,7 +65,10 @@ jobs:
uses: actions/checkout@v4

# Add here the download-artifact step

- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: output-log-file

# Placeholder - this step would be some action or run commands that deploys the code
- name: Deploy to test env
Expand Down
47 changes: 42 additions & 5 deletions .github/workflows/environments-secrets.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: 03-1. Environments and Secrets

on:
# push:
# branches: [main]
# pull_request:
# branches: [main]
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

# Limit the permissions of the GITHUB_TOKEN
Expand All @@ -19,6 +19,25 @@ env:
DEV_URL: 'https://docs.github.com/en/developers'

jobs:

use-secrets:
name: Use secrets
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- name: Hello world action with secrets
uses: actions/hello-world-javascript-action@main
with: # Set the secret as an input
who-to-greet: ${{ secrets.MY_REPO_SECRET }}
env: # Or as an environment variable
super_secret: ${{ secrets.MY_REPO_SECRET }}
- name: Echo secret is redacted in the logs
run: |
echo Env secret is ${{ secrets.MY_REPO_SECRET }}
echo Warning: GitHub automatically redacts secrets printed to the log,
echo but you should avoid printing secrets to the log intentionally.
echo ${{ secrets.MY_REPO_SECRET }} | sed 's/./& /g'

use-environment-dev:
name: Use DEV environment
runs-on: ubuntu-latest
Expand Down Expand Up @@ -72,12 +91,30 @@ jobs:
echo Org secret is ${{ secrets.MY_ORG_SECRET }}
echo Env secret is not accessible ${{ secrets.MY_ENV_SECRET }}


use-environment-uat:
name: Use UAT environment
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: use-environment-test

environment:
name: UAT
url: 'https://uat.github.com'

steps:
- name: Step that uses the UAT environment
run: echo "Deployment to UAT..."
env:
env_secret: ${{ secrets.MY_ENV_SECRET }}


use-environment-prod:
name: Use PROD environment
runs-on: ubuntu-latest
#if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}

needs: use-environment-test
needs: use-environment-uat

environment:
name: PROD
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/github-actions-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: 01-1. GitHub Actions Demo
on:
workflow_dispatch:
workflow_call:
push:
branches:
- main

jobs:
Explore-GitHub-Actions:
Expand All @@ -20,3 +23,12 @@ jobs:
- run: echo "🍏 This job's status is ${{ job.status }}."
- name: Adding markdown
run: echo "### Hello world! :rocket:" >> "$GITHUB_STEP_SUMMARY"
# This step uses GitHub's hello-world-javascript-action: https://github.com/actions/hello-world-javascript-action
- name: Hello world
uses: actions/hello-world-javascript-action@main
with:
who-to-greet: "Mona the Octocat"
id: hello
# This step prints an output (time) from the previous step's action.
- name: Echo the greeting's time
run: echo 'The time was ${{ steps.hello.outputs.time }}.'
12 changes: 12 additions & 0 deletions .github/workflows/github-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Thank you! We appreciate your contribution to this project.'
})
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Training']
})
18 changes: 16 additions & 2 deletions .github/workflows/hello-world-composite.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: 05-2. Hello World Composite

on:
[workflow_dispatch]
on:
pull_request:
branches: [main]
workflow_dispatch:

jobs:
hello_world_job1:
Expand All @@ -14,3 +16,15 @@ jobs:
who-to-greet: 'Hello from GH ABCs'
- run: echo random-number ${{ steps.hello-world.outputs.random-number }}
shell: bash

hello_world_job2:
runs-on: ubuntu-latest
name: A job2 to say hello
steps:
- uses: actions/checkout@v4
- id: hello-world
uses: ./.github/actions/hello-world-composite-action
with:
who-to-greet: 'Mona the Octocat from composite action'
- run: echo random-number from composite action ${{ steps.hello-world.outputs.random-number }}
shell: bash
46 changes: 42 additions & 4 deletions .github/workflows/job-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: 02-2. Dependencies

on:
workflow_dispatch:
# push:
# branches:
# - main
workflow_call:
push:
branches:
- main

jobs:
initial:
Expand All @@ -31,3 +31,41 @@ jobs:
needs: [fanout1, fanout2]
steps:
- run: echo "This job will run after fanout1 and fanout2 have finished."

build:
runs-on: ubuntu-latest
strategy:
matrix:
configuration: [debug, release]
steps:
- run: echo "This job builds the cofiguration ${{ matrix.configuration }}."
test:
runs-on: ubuntu-latest
needs: build
steps:
- run: echo "This job will be run after the build job."
ring01:
runs-on: ubuntu-latest
needs: test
steps:
- run: echo "This job will be run after the test job."
ring02:
runs-on: macos-latest
needs: test
steps:
- run: echo "This job will be run after the test job."
ring03:
runs-on: ubuntu-latest
needs: test
steps:
- run: echo "This job will be run after the test job."
ring04:
runs-on: ubuntu-latest
needs: [ring01,ring02,ring03]
steps:
- run: echo "This job will be run after the ring01,ring02,ring03 jobs."
prod:
runs-on: ubuntu-latest
needs: [ring04]
steps:
- run: echo "This job will be run after the ring04 job."
10 changes: 8 additions & 2 deletions .github/workflows/reusable-workflow-template.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: 04-1. Call Reusable Workflow Templates

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

jobs:
call_greet_everyone_workflow_job:
Expand All @@ -15,3 +17,7 @@ jobs:
call_demo_workflow_job:
needs: call_greet_everyone_workflow_job
uses: githubabcs/gh-abcs-actions/.github/workflows/github-actions-demo.yml@main

call_dependencies_workflow_job:
needs: call_reusable_workflow_job
uses: <YOUR_USER_ACCOUNT>/gh-abcs-actions/.github/workflows/job-dependencies.yml@main
2 changes: 1 addition & 1 deletion .github/workflows/use-custom-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
repo-token: ${{secrets.GITHUB_TOKEN}}
joke: ${{steps.jokes.outputs.joke-output}}
issue-title: "A joke for you from ${{ github.actor }}"
issue-title: "A joke for you from custom actions workflow"

docker-custom-actions:
runs-on: ubuntu-latest
Expand Down