From 22e5dd6113e5af469b2d591f156ff51ada26c3c3 Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Wed, 13 Dec 2023 15:22:45 +0100 Subject: [PATCH] Setup CI --- .github/dependabot.yml | 11 +++++ .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++ .github/workflows/generate-zips.yml | 40 ++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/generate-zips.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..8d70c65 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: maven + directory: /quarkus-workshop-super-heroes + open-pull-requests-limit: 40 + schedule: + interval: daily + labels: + - "version-upgrade" + pull-request-branch-name: + separator: "_" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c44afec --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,72 @@ +name: Build + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - name: Build + run: mvn -B install + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - name: Site generation + run: | + sudo apt-get install graphviz + export BASE_URL=`curl -Ls -o /dev/null -w %{url_effective} -I ${GITHUB_REPOSITORY_OWNER}.github.io` + + cd docs + mvn package + - name: Publishing fragment + uses: actions/upload-artifact@v3 + with: + name: fragments + path: ./docs/target/generated-asciidoc + if-no-files-found: error + retention-days: 3 + publication: + needs: [ docs, build ] + runs-on: ubuntu-latest + steps: + - name: Download default site + uses: actions/download-artifact@v3 + with: + name: fragments + path: target/generated-asciidoc + - name: Site assembly + run: | + mkdir -p target/site + cp -R target/generated-asciidoc/* target/site + - name: Store PR id + if: "github.event_name == 'pull_request'" + run: echo ${{ github.event.number }} > ./target/site/pr-id.txt + - name: Publishing directory for PR preview + if: "github.event_name == 'pull_request'" + uses: actions/upload-artifact@v3 + with: + name: site + path: ./target/site + retention-days: 3 + - name: Publication + if: "github.ref_name == 'main' && (github.event_name == 'push' || github.event_name == 'schedule')" + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./target/site diff --git a/.github/workflows/generate-zips.yml b/.github/workflows/generate-zips.yml new file mode 100644 index 0000000..272457a --- /dev/null +++ b/.github/workflows/generate-zips.yml @@ -0,0 +1,40 @@ +name: Generate zips + +on: + push: + branches: + - main + paths-ignore: + - 'docs/**' +jobs: + build: + runs-on: ubuntu-latest + concurrency: zip-generation + steps: + - uses: actions/checkout@v3 + - name: Install JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + run: mvn -B install + publication: + needs: [ build ] + runs-on: ubuntu-latest + concurrency: zip-generation + steps: + - uses: actions/checkout@v3 + - name: Install JDK 17 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + - name: Generate zips + run: | + mvn package -N + - name: Commit zips + run: | + git config --global user.name 'Github Actions' + git config --global user.email 'ci-action@users.noreply.github.com' + git commit -am "Automated zip generation" + git push