{"id":594,"date":"2025-08-02T09:32:53","date_gmt":"2025-08-02T07:32:53","guid":{"rendered":"https:\/\/www.oferto.io\/?p=594"},"modified":"2025-08-02T09:48:55","modified_gmt":"2025-08-02T07:48:55","slug":"automatiza-tus-despliegues-con-github-actions","status":"publish","type":"post","link":"https:\/\/www.oferto.io\/en\/automatiza-tus-despliegues-con-github-actions\/","title":{"rendered":"Automate your deployments with GitHub Actions"},"content":{"rendered":"<p><!-- T\u00edtulo y categor\u00eda --><\/p>\n<h2>Automate your deployments with GitHub Actions<\/h2>\n<p><strong>Category:<\/strong> DevOps<\/p>\n<p><!-- Extracto --><\/p>\n<p><em>Learn how to use GitHub Actions to automate your deployments. Learn how to set up a CI\/CD pipeline that builds, tests, and deploys your application on every push. <code>main<\/code>.<\/em><\/p>\n<p><!-- Imagen destacada: sugerencia de b\u00fasqueda --><\/p>\n<p><strong>Featured Image (search Envato Elements):<\/strong><br \/>\n<code>developer devops automation ci cd pipeline github concept<\/code><br \/>\n<br \/>Add \u201cisometric\u201d if you prefer vector illustrations.<\/p>\n<hr>\n<p><!-- Contenido --><\/p>\n<h3>What is GitHub Actions?<\/h3>\n<p>GitHub Actions is a GitHub-native automation platform that allows you to define custom workflows that run based on events (such as a <code>push<\/code>, <code>pull request<\/code> either <code>release<\/code>). You can use it for:<\/p>\n<ul>\n<li>Run tests automatically<\/li>\n<li>Compile and package your code<\/li>\n<li>Deploy to production without manual intervention<\/li>\n<\/ul>\n<p>All of this is defined by YAML files in the directory <code>.github\/workflows<\/code>.<\/p>\n<h3>Step 1: Create the basic workflow<\/h3>\n<p>Create the directory <code>.github\/workflows<\/code> in your repository and add a file <code>deploy.yml<\/code> with this basic content:<\/p>\n<pre><code class=\"language-yaml\">name: CI\/CD Pipeline on: push: branches: - main jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Clone repository uses: actions\/checkout@v3 - name: Install Java uses: actions\/setup-java@v3 with: java-version: &#039;17&#039; distribution: &#039;temurin&#039; - name: Build project run: .\/mvnw clean install - name: Build image Docker run: docker build -t myapp:latest . - name: Login to Docker Hub run: echo &quot;${{ secrets.DOCKER_PASSWORD }}&quot; | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin - name: Upload image run: docker tag myapp:latest docker.io\/youruser\/myapp:latest &amp;&amp; docker push docker.io\/youruser\/myapp:latest\r\n<\/code><\/pre>\n<p><strong>\u26a0\ufe0f Remember:<\/strong> Configure credentials <code>DOCKER_USERNAME<\/code> and <code>DOCKER_PASSWORD<\/code> in the <em>secrets<\/em> from the repository.<\/p>\n<h3>Step 2: Add the deployment step<\/h3>\n<p>Let&#039;s say you have a remote server where you want to deploy your container. You can use <code>scp<\/code> and <code>ssh<\/code> to copy the <code>docker-compose.yml<\/code> and release the new version:<\/p>\n<pre><code class=\"language-yaml\">      - name: Copy files to server run: | scp docker-compose.yml user@server-ip:\/home\/user\/app ssh user@server-ip &#039;cd \/home\/user\/app &amp;&amp; docker-compose pull &amp;&amp; docker-compose up -d&#039;\r\n<\/code><\/pre>\n<p>And add the necessary SSH keys like <em>secrets<\/em> (<code>SSH_PRIVATE_KEY<\/code>) and configure them before running the commands:<\/p>\n<pre><code class=\"language-yaml\">      - name: Configure SSH uses: webfactory\/ssh-agent@v0.8.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}\r\n<\/code><\/pre>\n<h3>Step 3: Additional improvements<\/h3>\n<ul>\n<li>Running tests before compiling<\/li>\n<li>Notifications to Slack or Discord upon completion<\/li>\n<li>Deployments to multiple environments (<code>staging<\/code>, <code>production<\/code>)<\/li>\n<li>Manual review before deployment (<code>workflow_dispatch<\/code>)<\/li>\n<li>Reusing jobs with <code>reusable workflows<\/code><\/li>\n<\/ul>\n<h3>Advantages of using GitHub Actions<\/h3>\n<ul>\n<li>\u2714\ufe0f Direct integration with your repository<\/li>\n<li>\ud83d\udd04 Guaranteed repeatability with every deployment<\/li>\n<li>\ud83d\udcc8 Continuous improvement in quality and speed<\/li>\n<li>\ud83d\udd12 Secure management of secrets and keys<\/li>\n<\/ul>\n<h3>Conclusion<\/h3>\n<p>GitHub Actions lets you automate everything from the most basic steps to complete CI\/CD workflows with productive deployments. Mastering this tool is key for any modern developer looking for efficiency and professionalism in their deliveries.<\/p>\n<p>Start with a simple flow and evolve into robust pipelines with validations, multiple environments, and continuous deployment. Automation isn&#039;t the future, it&#039;s the present.<\/p>","protected":false},"excerpt":{"rendered":"<p>GitHub Actions automates application deployment, automatically building, testing, and deploying with each push to the main branch. It also explains how to manage secrets and define execution conditions.<\/p>","protected":false},"author":1,"featured_media":596,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-594","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Automatiza tus despliegues con GitHub Actions - Oferto<\/title>\n<meta name=\"description\" content=\"GitHub Actions automatiza el despliegue de aplicaciones, compilando, probando y desplegando autom\u00e1ticamente con cada push a la rama principal. Tambi\u00e9n explica c\u00f3mo manejar secretos y definir condiciones de ejecuci\u00f3n.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.oferto.io\/en\/automatiza-tus-despliegues-con-github-actions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automatiza tus despliegues con GitHub Actions - Oferto\" \/>\n<meta property=\"og:description\" content=\"GitHub Actions automatiza el despliegue de aplicaciones, compilando, probando y desplegando autom\u00e1ticamente con cada push a la rama principal. Tambi\u00e9n explica c\u00f3mo manejar secretos y definir condiciones de ejecuci\u00f3n.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.oferto.io\/en\/automatiza-tus-despliegues-con-github-actions\/\" \/>\n<meta property=\"og:site_name\" content=\"Oferto\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-02T07:32:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-02T07:48:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.oferto.io\/wp-content\/uploads\/2025\/08\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1500\" \/>\n\t<meta property=\"og:image:height\" content=\"1000\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"doominio\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/\"},\"author\":{\"name\":\"doominio\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#\\\/schema\\\/person\\\/6ee60897fbb7fb4ad6634c73f4be87fa\"},\"headline\":\"Automatiza tus despliegues con GitHub Actions\",\"datePublished\":\"2025-08-02T07:32:53+00:00\",\"dateModified\":\"2025-08-02T07:48:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/\"},\"wordCount\":331,\"publisher\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.oferto.io\\\/wp-content\\\/uploads\\\/2025\\\/08\\\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg\",\"articleSection\":[\"DevOps\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/\",\"url\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/\",\"name\":\"Automatiza tus despliegues con GitHub Actions - Oferto\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.oferto.io\\\/wp-content\\\/uploads\\\/2025\\\/08\\\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg\",\"datePublished\":\"2025-08-02T07:32:53+00:00\",\"dateModified\":\"2025-08-02T07:48:55+00:00\",\"description\":\"GitHub Actions automatiza el despliegue de aplicaciones, compilando, probando y desplegando autom\u00e1ticamente con cada push a la rama principal. Tambi\u00e9n explica c\u00f3mo manejar secretos y definir condiciones de ejecuci\u00f3n.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.oferto.io\\\/wp-content\\\/uploads\\\/2025\\\/08\\\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg\",\"contentUrl\":\"https:\\\/\\\/www.oferto.io\\\/wp-content\\\/uploads\\\/2025\\\/08\\\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg\",\"width\":1500,\"height\":1000,\"caption\":\"Software developing\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/automatiza-tus-despliegues-con-github-actions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Inicio\",\"item\":\"https:\\\/\\\/www.oferto.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automatiza tus despliegues con GitHub Actions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#website\",\"url\":\"https:\\\/\\\/www.oferto.io\\\/\",\"name\":\"Oferto\",\"description\":\"Software Toolbox\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.oferto.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#organization\",\"name\":\"Oferto\",\"url\":\"https:\\\/\\\/www.oferto.io\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.oferto.io\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/image.png\",\"contentUrl\":\"https:\\\/\\\/www.oferto.io\\\/wp-content\\\/uploads\\\/2025\\\/07\\\/image.png\",\"width\":1385,\"height\":437,\"caption\":\"Oferto\"},\"image\":{\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"http:\\\/\\\/www.linkedin.com\\\/in\\\/masalinas\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.oferto.io\\\/#\\\/schema\\\/person\\\/6ee60897fbb7fb4ad6634c73f4be87fa\",\"name\":\"doominio\",\"sameAs\":[\"https:\\\/\\\/www.oferto.io\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automate your deployments with GitHub Actions - Oferto","description":"GitHub Actions automates application deployment, automatically building, testing, and deploying with each push to the main branch. It also explains how to manage secrets and define execution conditions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.oferto.io\/en\/automatiza-tus-despliegues-con-github-actions\/","og_locale":"en_US","og_type":"article","og_title":"Automatiza tus despliegues con GitHub Actions - Oferto","og_description":"GitHub Actions automatiza el despliegue de aplicaciones, compilando, probando y desplegando autom\u00e1ticamente con cada push a la rama principal. Tambi\u00e9n explica c\u00f3mo manejar secretos y definir condiciones de ejecuci\u00f3n.","og_url":"https:\/\/www.oferto.io\/en\/automatiza-tus-despliegues-con-github-actions\/","og_site_name":"Oferto","article_published_time":"2025-08-02T07:32:53+00:00","article_modified_time":"2025-08-02T07:48:55+00:00","og_image":[{"width":1500,"height":1000,"url":"https:\/\/www.oferto.io\/wp-content\/uploads\/2025\/08\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg","type":"image\/jpeg"}],"author":"doominio","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/#article","isPartOf":{"@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/"},"author":{"name":"doominio","@id":"https:\/\/www.oferto.io\/#\/schema\/person\/6ee60897fbb7fb4ad6634c73f4be87fa"},"headline":"Automatiza tus despliegues con GitHub Actions","datePublished":"2025-08-02T07:32:53+00:00","dateModified":"2025-08-02T07:48:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/"},"wordCount":331,"publisher":{"@id":"https:\/\/www.oferto.io\/#organization"},"image":{"@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/#primaryimage"},"thumbnailUrl":"https:\/\/www.oferto.io\/wp-content\/uploads\/2025\/08\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg","articleSection":["DevOps"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/","url":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/","name":"Automate your deployments with GitHub Actions - Oferto","isPartOf":{"@id":"https:\/\/www.oferto.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/#primaryimage"},"image":{"@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/#primaryimage"},"thumbnailUrl":"https:\/\/www.oferto.io\/wp-content\/uploads\/2025\/08\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg","datePublished":"2025-08-02T07:32:53+00:00","dateModified":"2025-08-02T07:48:55+00:00","description":"GitHub Actions automates application deployment, automatically building, testing, and deploying with each push to the main branch. It also explains how to manage secrets and define execution conditions.","breadcrumb":{"@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/#primaryimage","url":"https:\/\/www.oferto.io\/wp-content\/uploads\/2025\/08\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg","contentUrl":"https:\/\/www.oferto.io\/wp-content\/uploads\/2025\/08\/programmer-using-stylus-and-laptop-to-write-code-a-2025-06-05-17-01-16-utc.jpg","width":1500,"height":1000,"caption":"Software developing"},{"@type":"BreadcrumbList","@id":"https:\/\/www.oferto.io\/automatiza-tus-despliegues-con-github-actions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Inicio","item":"https:\/\/www.oferto.io\/"},{"@type":"ListItem","position":2,"name":"Automatiza tus despliegues con GitHub Actions"}]},{"@type":"WebSite","@id":"https:\/\/www.oferto.io\/#website","url":"https:\/\/www.oferto.io\/","name":"Oferto","description":"Software Toolbox","publisher":{"@id":"https:\/\/www.oferto.io\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.oferto.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.oferto.io\/#organization","name":"Oferto","url":"https:\/\/www.oferto.io\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.oferto.io\/#\/schema\/logo\/image\/","url":"https:\/\/www.oferto.io\/wp-content\/uploads\/2025\/07\/image.png","contentUrl":"https:\/\/www.oferto.io\/wp-content\/uploads\/2025\/07\/image.png","width":1385,"height":437,"caption":"Oferto"},"image":{"@id":"https:\/\/www.oferto.io\/#\/schema\/logo\/image\/"},"sameAs":["http:\/\/www.linkedin.com\/in\/masalinas\/"]},{"@type":"Person","@id":"https:\/\/www.oferto.io\/#\/schema\/person\/6ee60897fbb7fb4ad6634c73f4be87fa","name":"domain","sameAs":["https:\/\/www.oferto.io"]}]}},"_links":{"self":[{"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/posts\/594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/comments?post=594"}],"version-history":[{"count":3,"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/posts\/594\/revisions"}],"predecessor-version":[{"id":611,"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/posts\/594\/revisions\/611"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/media\/596"}],"wp:attachment":[{"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/media?parent=594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/categories?post=594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oferto.io\/en\/wp-json\/wp\/v2\/tags?post=594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}