From bf02657481b9f1cddcb21f66ab2b877dbf345351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 24 Jan 2024 10:46:27 +0100 Subject: [PATCH] Setup gitea action to build the website, build docker image and push it on registry --- .gitea/workflows/build-image.yaml | 73 +++++++++++++++ .github/workflows/main.yml | 75 --------------- .idea/.gitignore | 8 -- .idea/{hugoplate.iml => chill_hugoplate.iml} | 0 .idea/codeStyles/Project.xml | 62 ++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/inspectionProfiles/Project_Default.xml | 6 ++ .idea/jsLinters/jshint.xml | 16 ++++ .idea/modules.xml | 2 +- .idea/workspace.xml | 99 ++++++++++++++++++++ Caddyfile | 3 - Dockerfile | 4 +- go.mod | 45 +++++---- 13 files changed, 285 insertions(+), 113 deletions(-) create mode 100644 .gitea/workflows/build-image.yaml delete mode 100644 .github/workflows/main.yml delete mode 100644 .idea/.gitignore rename .idea/{hugoplate.iml => chill_hugoplate.iml} (100%) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/jsLinters/jshint.xml create mode 100644 .idea/workspace.xml delete mode 100644 Caddyfile diff --git a/.gitea/workflows/build-image.yaml b/.gitea/workflows/build-image.yaml new file mode 100644 index 0000000..232813e --- /dev/null +++ b/.gitea/workflows/build-image.yaml @@ -0,0 +1,73 @@ +name: Build an image to deploy website + +on: + # Runs on pushes targeting the default branch + push: + tags: + - v* + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Environment variables available to all jobs and steps in this workflow +env: + HUGO_ENV: production + HUGO_VERSION: "0.121.2" + GO_VERSION: "1.21.4" + NODE_VERSION: "18" + +jobs: + # Build job + build: + runs-on: cth-ubuntu-latest + steps: + - name: Check out repository + uses: https://github.com/actions/checkout@v4 + + - name: Setup node + uses: https://github.com/actions/setup-node@v4 + with: + node-version: '${{ NODE_VERSION }}' + + - name: Setup Hugo + uses: https://github.com/peaceiris/actions-hugo@v2 + with: + hugo-version: '${{ HUGO_VERSION }}' + extended: true + + - name: Setup Go + uses: https://github.com/actions/setup-go@v5 + with: + go-version: '1.21.4' + + - name: Setup Project + run: npm run project-setup + + - name: Install npm dependencies + run: npm install + + - name: Compile website + run: npm run build + + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + + - name: Login to registry + uses: https://github.com/docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: 'h3m6q87t.gra7.container-registry.ovh.net' + + - name: debug + run: ls -lah + + - name: Build and push + uses: https://github.com/docker/build-push-action@v5 + with: + context: . + push: true + tags: 'h3m6q87t.gra7.container-registry.ovh.net/chill_website/web:${{ github.ref_name }}' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index c10c7fe..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Sample workflow for building and deploying a Hugo site to GitHub Pages -name: Deploy Hugo site to Pages - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Environment variables available to all jobs and steps in this workflow -env: - HUGO_ENV: production - HUGO_VERSION: "0.118.2" - GO_VERSION: "1.20.5" - NODE_VERSION: "18.15.0" - TINA_CLIENT_ID: ${{ vars.TINA_CLIENT_ID }} - TINA_TOKEN: ${{ vars.TINA_TOKEN }} - -jobs: - # Build job - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Install Hugo - run: | - curl -LO "https://github.com/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz" - tar -xvf hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz - sudo mv hugo /usr/local/bin/ - rm hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz - hugo version - - - name: Install Go - run: | - curl -LO "https://dl.google.com/go/go${{ env.GO_VERSION }}.linux-amd64.tar.gz" - sudo tar -C /usr/local -xzf go${{ env.GO_VERSION }}.linux-amd64.tar.gz - echo "export PATH=$PATH:/usr/local/go/bin" >> $GITHUB_ENV - rm go${{ env.GO_VERSION }}.linux-amd64.tar.gz - go version - - - name: Setup Project - run: npm run project-setup - - - name: Install npm dependencies - run: npm install - - - name: Publish to GitHub Pages - run: npm run build - - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 - with: - path: ./public - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/hugoplate.iml b/.idea/chill_hugoplate.iml similarity index 100% rename from .idea/hugoplate.iml rename to .idea/chill_hugoplate.iml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..c1bbb47 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..eff7139 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLinters/jshint.xml b/.idea/jsLinters/jshint.xml new file mode 100644 index 0000000..194fe81 --- /dev/null +++ b/.idea/jsLinters/jshint.xml @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 323f7bc..8b5c9d1 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..a50a9ca --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1706086985231 + + + + + + + + + + + + \ No newline at end of file diff --git a/Caddyfile b/Caddyfile deleted file mode 100644 index b6249b5..0000000 --- a/Caddyfile +++ /dev/null @@ -1,3 +0,0 @@ -chill.social { - root /public -} diff --git a/Dockerfile b/Dockerfile index 0d945fd..c4c3953 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,3 @@ -FROM klakegg/hugo:alpine-onbuild AS hugo - FROM caddy:2-alpine -ADD src/ /usr/share/caddy/ +ADD public/ /usr/share/caddy/ diff --git a/go.mod b/go.mod index 5d1f93b..4db21c3 100644 --- a/go.mod +++ b/go.mod @@ -3,27 +3,26 @@ module hugoplate.netlify.app go 1.20 require ( - github.com/gethugothemes/hugo-modules/accordion v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/adsense v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/components/cookie-consent v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/components/custom-script v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/components/preloader v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/components/render-link v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/components/social-share v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/gallery-slider v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/gzip-caching v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/icons/font-awesome v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/images v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/modal v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/pwa v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/search v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/seo-tools/basic-seo v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/seo-tools/google-tag-manager v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/seo-tools/site-verifications v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/shortcodes/button v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/shortcodes/notice v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/tab v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/table-of-contents v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/gethugothemes/hugo-modules/videos v0.0.0-20231001043352-2e720c5b7e8b // indirect - github.com/zeon-studio/hugoplate v0.0.0-20230919033707-39e487943d6d // indirect + github.com/gethugothemes/hugo-modules/accordion v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/adsense v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/components/cookie-consent v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/components/custom-script v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/components/preloader v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/components/render-link v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/components/social-share v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/gallery-slider v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/gzip-caching v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/icons/font-awesome v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/images v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/modal v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/pwa v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/search v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/seo-tools/basic-seo v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/seo-tools/google-tag-manager v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/seo-tools/site-verifications v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/shortcodes/button v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/shortcodes/notice v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/tab v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/table-of-contents v0.0.0-20231213094845-42e6b5af6245 // indirect + github.com/gethugothemes/hugo-modules/videos v0.0.0-20231213094845-42e6b5af6245 // indirect )