Difference between revisions of "GitHub Actions"
From Christoph's Personal Wiki
(→Basic) |
(→Basic) |
||
Line 28: | Line 28: | ||
(platform.processor()) | (platform.processor()) | ||
shell: python | shell: python | ||
+ | </pre> | ||
+ | |||
+ | * Using the GitHub CLI: | ||
+ | <pre> | ||
+ | $ gh workflow view | ||
+ | ? Select a workflow Shell Commands (simple.yaml) | ||
+ | Shell Commands - simple.yaml | ||
+ | ID: 13613098 | ||
+ | |||
+ | Total runs 1 | ||
+ | Recent runs | ||
+ | ✓ initial commit of .github/workflows/simple.yaml Shell Commands master push 1280462255 | ||
+ | |||
+ | To see more runs for this workflow, try: gh run list --workflow simple.yaml | ||
+ | To see the YAML for this workflow, try: gh workflow view simple.yaml --yaml | ||
+ | |||
+ | $ gh workflow view simple.yaml --yaml | ||
+ | Shell Commands - simple.yaml | ||
+ | ID: 13613098 | ||
+ | |||
+ | name: Shell Commands | ||
+ | |||
+ | on: [push] | ||
+ | |||
+ | jobs: | ||
+ | run-shell-command: | ||
+ | runs-on: ubuntu-latest | ||
+ | steps: | ||
+ | - name: echo a string | ||
+ | run: echo "Hello World" | ||
+ | - name: multiline script | ||
+ | run: | | ||
+ | node -v | ||
+ | npm -v | ||
+ | - name: python Command | ||
+ | run: | | ||
+ | import platform | ||
+ | print | ||
+ | (platform.processor()) | ||
+ | shell: python | ||
+ | |||
+ | |||
+ | $ gh run list --workflow simple.yaml | ||
+ | STATUS NAME WORKFLOW BRANCH EVENT ID ELAPSED AGE | ||
+ | ✓ initial commit of .github/workflows/simple.yaml Shell Commands master push 1280462255 15s 15d | ||
+ | |||
+ | For details on a run, try: gh run view <run-id> | ||
+ | |||
+ | $ gh run view 1280462255 | ||
+ | |||
+ | ✓ master Shell Commands · 1280462255 | ||
+ | Triggered via push about 16 days ago | ||
+ | |||
+ | JOBS | ||
+ | ✓ run-shell-command in 1s (ID 3726651254) | ||
+ | |||
+ | For more information about a job, try: gh run view --job=<job-id> | ||
+ | View this run on GitHub: https://github.com/christophchamp/github-actions/actions/runs/1280462255 | ||
</pre> | </pre> | ||
Revision as of 00:15, 14 October 2021
GitHub Actions is a service provided by GitHub that allows building continuous integration and continuous deployment (CI/CD) pipelines for testing, releasing, and deploying software without the use of third-party websites/platforms.
Examples
Basic
$ cat .github/workflows/basic.yaml name: Shell Commands on: [push] jobs: run-shell-commands: runs-on: ubuntu-latest steps: - name: echo a string run: echo "Hello, World!" - name: multiline script run: | node -v npm -v - name: python command run: | import platform print (platform.processor()) shell: python
- Using the GitHub CLI:
$ gh workflow view ? Select a workflow Shell Commands (simple.yaml) Shell Commands - simple.yaml ID: 13613098 Total runs 1 Recent runs ✓ initial commit of .github/workflows/simple.yaml Shell Commands master push 1280462255 To see more runs for this workflow, try: gh run list --workflow simple.yaml To see the YAML for this workflow, try: gh workflow view simple.yaml --yaml $ gh workflow view simple.yaml --yaml Shell Commands - simple.yaml ID: 13613098 name: Shell Commands on: [push] jobs: run-shell-command: runs-on: ubuntu-latest steps: - name: echo a string run: echo "Hello World" - name: multiline script run: | node -v npm -v - name: python Command run: | import platform print (platform.processor()) shell: python $ gh run list --workflow simple.yaml STATUS NAME WORKFLOW BRANCH EVENT ID ELAPSED AGE ✓ initial commit of .github/workflows/simple.yaml Shell Commands master push 1280462255 15s 15d For details on a run, try: gh run view <run-id> $ gh run view 1280462255 ✓ master Shell Commands · 1280462255 Triggered via push about 16 days ago JOBS ✓ run-shell-command in 1s (ID 3726651254) For more information about a job, try: gh run view --job=<job-id> View this run on GitHub: https://github.com/christophchamp/github-actions/actions/runs/1280462255