Basically its way getting started with GitHub Actions, its used for how to automate and customize your software development workflow by using GitHub Actions. First, how a GitHub Action functions by learning its core concepts and key characteristics. Next, Needs hands-on approach in a GitHub project repository by using a featured template workflow file with continuous integration (CI) and customize it with unit tests, build artifacts, and environment variables. Finally, how to use community GitHub Actions from the GitHub Marketplace to extend your customized software development workflow. GitHub actions to extend, automate, and customize your workflow experience.
Github Docs:
https://docs.github.com/en/get-started
GitHub-hosted runners:
https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
GitHub Actions:
https://docs.github.com/en/actions
https://docs.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners
Prettier - Code formatter:
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
YAML:
https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
YAML to JSON:
https://marketplace.visualstudio.com/items?itemName=ahebrank.yaml2json
Managing workflow runs:
https://docs.github.com/en/actions/managing-workflow-runs#enabling-debug-logging
specific shell:
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
hello-world-javascript-action project:
https://github.com/actions/hello-world-javascript-action
Actions plugins:
https://github.com/marketplace?type=actions
GitHub Checkout Usage:
https://github.com/actions/checkout#usage
GitHub workflow:
https://docs.github.com/en/actions/reference/events-that-trigger-workflows
For cron jobs:
on:
schedule:
- cron: "0/5 * * * *"
"min hour day(month) month day(week)"
https://crontab.guru/
CronJob Examples:
https://crontab.guru/examples.html
Create a repository dispatch event:
https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event
GitHub Action course meterial:
https://github.com/ramanujadasu/github-actions-course
Check all the brach's for more topics
Dispatch Event:
https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event
Filter Pattern:
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
Environment Variables:
https://docs.github.com/en/actions/reference/environment-variables
Workflow Authentication:
https://docs.github.com/en/actions/reference/authentication-in-a-workflow
Example workflow: .github/workflows/manual.yaml
Reference: https://github.com/ramanujadasu/github-actions-course/new/master?filename=.github%2Fworkflows%2Fmanual.yml&workflow_template=manual
<code:java>
====================================================
# This is a basic workflow that is manually triggered
name: Manual workflow
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
# Friendly description to be shown in the UI instead of 'name'
description: 'Person to greet'
# Default value if no value is explicitly provided
default: 'World'
# Input has to be provided for the workflow to run
required: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Send greeting
run: echo "Hello ${{ github.event.inputs.name }}"
===================================================
Example workflow: .github/workflows/test.yaml
===================================================
name: Test Build
on:
#To fetch the other repository
repository_dispatch:
types: [build]
#Workflow dispatch
workflow_dispatch:
inputs:
message:
description: ''
required: false
default: ''
push:
types: [closed, assigned, opened, reopened]
branches:
- master
- 'feature/*'
- 'feature/**'
- '!feature/featC' # if matchs also it will ignore
- release-20[2-9][1-9].[0-9][0-9].[0-9][0-9]
# if not using branches
branches-ignore:
- 'feature/featC'
tag:
- "v1.*"
paths:
- "**.js"
path_ignore:
- "docs/*"
pull_request:
types: [closed, assigned, opened, reopened]
branches:
- master
- release-20[2-9][1-9].[0-9][0-9].[0-9][0-9]
env:
REPO: ${{ github.repository }}
BUILD_PATH: ${{ github.workspace }}
DOCKER_IMAGE_NAME: "test/build"
DOCKER_IMAGE_VERSION_PREFIX: "1.0.0"
BUILD_ARGS: "--build-arg <env variable"
jobs:
build:
name: Build Python Application
runs-on: [ ubuntu-latest ]
timeout-minutes: 10
strategy:
matrix:
python-version: [3.6.10]
steps:
# Checkout the repo code to be used for build activity
- name: Checkout the Repository Source Code
uses: actions/checkout@v2
with:
fetch-depth: 1
env:
WF_ENC_ENV: ${{secrets.WF_ENV}}
WF_TEST_ENV: Test Env
- name: Get Build Scripts
run: |
curl -s -u <url> | bash
chmod -R 777 tscripts
shell: bash
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run Code Scan for SonarQube
run: |
sudo apt-get update
sudo apt-get install bc
bash tscripts/sonarqube.sh
shell: bash
- name: Build DockerImage if push to master or release branch's
run: |
bash tscripts/dbuild/build.sh
shell: bash
</code:java>
No comments:
Post a Comment
I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.