├── index.html ├── Dockerfile ├── imagenes ├── crear.png ├── creado.png ├── cuenta.png ├── generar.png ├── secreto.png ├── secretos.png ├── configuracion.png ├── nuevo_secreto.png ├── nuevo_token.png └── crear_repositorio.png ├── .github └── workflows │ └── push.yml └── README.md /index.html: -------------------------------------------------------------------------------- 1 | Hola Mundo 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.19-alpine 2 | 3 | ADD index.html /usr/share/nginx/html 4 | -------------------------------------------------------------------------------- /imagenes/crear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/crear.png -------------------------------------------------------------------------------- /imagenes/creado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/creado.png -------------------------------------------------------------------------------- /imagenes/cuenta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/cuenta.png -------------------------------------------------------------------------------- /imagenes/generar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/generar.png -------------------------------------------------------------------------------- /imagenes/secreto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/secreto.png -------------------------------------------------------------------------------- /imagenes/secretos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/secretos.png -------------------------------------------------------------------------------- /imagenes/configuracion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/configuracion.png -------------------------------------------------------------------------------- /imagenes/nuevo_secreto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/nuevo_secreto.png -------------------------------------------------------------------------------- /imagenes/nuevo_token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/nuevo_token.png -------------------------------------------------------------------------------- /imagenes/crear_repositorio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juancondorijara/GitHub_Actions/HEAD/imagenes/crear_repositorio.png -------------------------------------------------------------------------------- /.github/workflows/push.yml: -------------------------------------------------------------------------------- 1 | name: Pubish to Docker/DockerHub 2 | on: push 3 | jobs: 4 | build: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Check source code 8 | uses: actions/checkout@v3 9 | 10 | - name: Get image tag 11 | id: tags 12 | shell: bash 13 | run: | 14 | echo "::set-output name=version::$(sed -r 'ls/.+alpine://' $GITHUB_WORKSPACE/Dockerfile)" 15 | - name: Setup Docker Buildx 16 | uses: docker/setup-buildx-action@v2 17 | 18 | - name: Login to DockerHub 19 | uses: docker/login-action@v2 20 | with: 21 | username: ${{ secrets.DOCKER_HUB_USERNAME }} 22 | password: ${{ secrets.DOCKER_HUB_TOKEN }} 23 | 24 | - name: Build and Push to Docker Hub 25 | uses: docker/build-push-action@v2 26 | with: 27 | push: true 28 | tags: | 29 | ${{ secrets.DOCKER_HUB_NAMESPACE }}/github_actions:latest 30 | ${{ secrets.DOCKER_HUB_NAMESPACE }}/github_actions:latest 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # **Github Actions - Demo** 2 | 3 | ## **Herramientas y tecnologías usadas** 4 | 5 | - Docker Desktop Windows / Ubuntu 18.04 6 | 7 | ## **Creando carpeta de proyecto** 8 | 9 | - Crear carpeta .github/workflows 10 | 11 | - Crear el archivo **push.yml** 12 | 13 | - Definiendo la acción: 14 | 15 | * Nombre de la acción. 16 | 17 | * Evento de ejecución. 18 | 19 | * Definir sistema operativo (ubuntu). 20 | 21 | * Usar los secrets de GitHub 22 | 23 | ## **Crear repositorio en Docker Hub** 24 | 25 | - Click en el botón Create Repository 26 | 27 | ![](imagenes/crear_repositorio.png) 28 | 29 | - Colocar un nombre, descripción, de manera publica y le damos en Create 30 | 31 | ![](imagenes/crear.png) 32 | 33 | - Se creará el repositorio 34 | 35 | ![](imagenes/creado.png) 36 | 37 | ## **Generar token de Docker Hub** 38 | 39 | - Ingresar a Account Settings 40 | 41 | ![](imagenes/cuenta.png) 42 | 43 | - Ir a la opción de Security y dar click New Access Token 44 | 45 | ![](imagenes/nuevo_token.png) 46 | 47 | - Ingresar descripción, definir los permisos del Token y click en Generate 48 | 49 | ![](imagenes/generar.png) 50 | 51 | ## **Crear los secrets en el repositorio de Github** 52 | 53 | - Ir al repositorio en Settings 54 | 55 | ![](imagenes/configuracion.png) 56 | 57 | - Ir a la opción de Security / Secrets / Actions 58 | 59 | ![](imagenes/secreto.png) 60 | 61 | - Click en New Repository Secret 62 | 63 | ![](imagenes/nuevo_secreto.png) 64 | 65 | - Crear los siguientes secrets con los datos de nuestro Docker Hub 66 | 67 | - DOCKER_HUB_USERNAME 68 | - DOCKER_HUB_PASSWORD 69 | - DOCKER_HUB_TOKEN 70 | - DOCKER_HUB_NAMESPACE 71 | 72 | ![](imagenes/secretos.png) 73 | --------------------------------------------------------------------------------