Sistemas y Tecnologías Web: Servidor

Master de II. ULL. 1er cuatrimestre


Organization ULL-MII-SYTWS-2122   Classroom ULL-MII-SYTWS-2122   Campus Virtual SYTWS   Chat Chat   Profesor Casiano

GitHub Action Hello World

Goals

Write a GitHub Action Hello World following the tutorial at section Hello Actions World!.

  1. Save the action code in repo hello-js-action-aluXXX,
    • Change the visibility of this repo to public (go to settings/manage access)
  2. Inside repo use-hello-js-action-aluXXX save the project using the action and
  3. In repo hello-js-action-super build a repo having the former two as submodules
  4. Write your README.md report in the superproject repo.
  5. Set GitHub pages
    • Set the main branch and the root of the superproject
    • Choose one of the page supported themes for the static generator Jekyll
    • Set the github.io URL in the description section of the superproject

Optional Step

If you feel enthusiastic about GitHub Actions, continue using the repo actions/javascript-action as a template and follow the instructions. Save the action code in repo hello-js-action-aluXXX but in a branch with name optional.

To use this new action, you have to reference it in the client repo like this:

1
2
steps:    
  - uses: ULL-ESIT-PL-1920/hello-js-action-aluXXX@optional  # Reference a branch

Pay special attention to how the tests were written in this example.

Build your own GitHub Action

Think of ideas to write your own GH Action.

For example, this repo crguezl/pandoc-gitpod-template uses GitHub Actions to convert some markdown files, producing the pdf as an artifact. See the workflow file and the actions running

Here is an action BaileyJM02/markdown-to-pdf that creates PDF and HTML files from Markdown using the GitHub (or custom) theme.

There are actions to run MatLab, to deploy to different platforms, … here is the github actions marketplace

gh workflow

You can now create workflows that are manually triggered with the new workflow_dispatch event.

You will then see a Run workflow button on the Actions tab, enabling you to easily trigger a run.

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
➜  use-hello-world-javascript-action git:(master) gh help workflow
List, view, and run workflows in GitHub Actions.

USAGE
  gh workflow <command> [flags]

CORE COMMANDS
  disable:    Disable a workflow
  enable:     Enable a workflow
  list:       List workflows
  run:        Run a workflow by creating a workflow_dispatch event
  view:       View the summary of a workflow

FLAGS
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format

INHERITED FLAGS
  --help   Show help for command

LEARN MORE
  Use 'gh <command> <subcommand> --help' for more information about a command.
  Read the manual at https://cli.github.com/manual



A new release of gh is available: 1.9.1 → v1.9.2
To upgrade, run: brew update && brew upgrade gh
https://github.com/cli/cli/releases/tag/v1.9.2

Example

1
gh workflow run manual.yml -f name=PL2021

To view a workflow:

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
➜  use-hello-world-javascript-action git:(master) ✗ gh workflow view --help
View the summary of a workflow

USAGE
  gh workflow view [<workflow-id> | <workflow-name> | <filename>] [flags]

FLAGS
  -r, --ref string   The branch or tag name which contains the version of the workflow file you'd like to view
  -w, --web          Open workflow in the browser
  -y, --yaml         View the workflow yaml file

INHERITED FLAGS
      --help                     Show help for command
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format

EXAMPLES
  # Interactively select a workflow to view
  $ gh workflow view
  
  # View a specific workflow
  $ gh workflow view 0451

LEARN MORE
  Use 'gh <command> <subcommand> --help' for more information about a command.
  Read the manual at https://cli.github.com/manual

Videos de clases relacionadas con las GH Actions

References

Rúbrica

Incidencias para el Project Board para la práctica

GitHub Action Hello World

  • La acción está publicada y se usa correctamente

  • Las GitHub pages funcionan correctamente en el super repo

  • Se ha instalado Jekyll y puede ver las páginas generadas en local

  • Opcional: En la práctica anterior se ha extendido la CI para Mac OS y Windows

Comment with GitHub Utterances