Skip to content

Instantly share code, notes, and snippets.

@maxisandoval37
Last active March 4, 2025 00:01
Show Gist options
  • Save maxisandoval37/99e2c0621b002c041c56e7bf109cf8ea to your computer and use it in GitHub Desktop.
Save maxisandoval37/99e2c0621b002c041c56e7bf109cf8ea to your computer and use it in GitHub Desktop.
Build and Test Maven - Github Action Example
# --------------------# --------------------# --------------------# --------------------# --------------------
# 1) Crear rama: gh-pages
# 2) Generar Tokens
# PROFILE -> settings -> Developer Settings -> Tokens (classic)
# ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# REPO -> settings -> Secrets and variables -> Actions -> New repository secret
# TOKEN_APP
# 2) .github/workflows/maven.yml
# https://gist.github.com/maxisandoval37/99e2c0621b002c041c56e7bf109cf8ea
# --------------------
# https://maxisandoval37.github.io/test/
# https://<tu-usuario-github>.github.io/<nombre-repositorio>
# --------------------# --------------------# --------------------# --------------------# --------------------
# https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-maven
# --------------------# --------------------# --------------------# --------------------# --------------------
name: Build and Test
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Build and Test
run: mvn clean install test
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.TOKEN_APP }}
publish_dir: ./target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment