Setup gitea action to build the website, build docker image and push it on registry

This commit is contained in:
Julien Fastré 2024-01-24 10:46:27 +01:00
parent eeda5a041e
commit bf02657481
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
13 changed files with 285 additions and 113 deletions

View File

@ -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 }}'

View File

@ -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

8
.idea/.gitignore generated vendored
View File

@ -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

62
.idea/codeStyles/Project.xml generated Normal file
View File

@ -0,0 +1,62 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<HTMLCodeStyleSettings>
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
</HTMLCodeStyleSettings>
<JSCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</JSCodeStyleSettings>
<TypeScriptCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</TypeScriptCodeStyleSettings>
<VueCodeStyleSettings>
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
</VueCodeStyleSettings>
<codeStyleSettings language="HTML">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Vue">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="yaml">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>

16
.idea/jsLinters/jshint.xml generated Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSHintConfiguration" version="2.13.6" use-config-file="true" use-custom-config-file="true" custom-config-file-path="$PROJECT_DIR$/.jshintrc">
<option bitwise="true" />
<option browser="true" />
<option curly="true" />
<option eqeqeq="true" />
<option forin="true" />
<option maxerr="50" />
<option noarg="true" />
<option noempty="true" />
<option nonew="true" />
<option strict="true" />
<option undef="true" />
</component>
</project>

2
.idea/modules.xml generated
View File

@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/hugoplate.iml" filepath="$PROJECT_DIR$/.idea/hugoplate.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/chill_hugoplate.iml" filepath="$PROJECT_DIR$/.idea/chill_hugoplate.iml" />
</modules>
</component>
</project>

99
.idea/workspace.xml generated Normal file
View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="f045a27b-2f7c-4e29-b0d1-b2f3a8438404" name="Changes" comment="Setup docker image and CI" />
<list id="e6042637-2834-4c28-8317-b4fabf609992" name="Changes by julielenaerts" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ComposerSettings">
<execution />
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
<entry key="$PROJECT_DIR$" value="main" />
</map>
</option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="KubernetesApiProvider"><![CDATA[{
"isMigrated": true
}]]></component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="PhpWorkspaceProjectConfiguration" interpreter_name="/bin/php" />
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 0
}]]></component>
<component name="ProjectId" id="2bOXEJ77FlOs2KdDsagHQb8lOI4" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
<option name="showMembers" value="true" />
<option name="sortByType" value="true" />
<option name="sortKey" value="BY_TYPE" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"git-widget-placeholder": "gitea-ci",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="bundled-php-predefined-ba97393d7c68-b4dcf6bb9de9-com.jetbrains.php.sharedIndexes-PS-233.13135.108" />
</set>
</attachedChunks>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="f045a27b-2f7c-4e29-b0d1-b2f3a8438404" name="Changes" comment="" />
<created>1706086985231</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1706086985231</updated>
<workItem from="1706086986311" duration="2804000" />
</task>
<task id="LOCAL-00001" summary="Setup docker image and CI">
<option name="closed" value="true" />
<created>1706089591660</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1706089591660</updated>
</task>
<task id="LOCAL-00002" summary="Setup docker image and CI">
<option name="closed" value="true" />
<created>1706089758423</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1706089758423</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Setup docker image and CI" />
<option name="LAST_COMMIT_MESSAGE" value="Setup docker image and CI" />
</component>
</project>

View File

@ -1,3 +0,0 @@
chill.social {
root /public
}

View File

@ -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/

45
go.mod
View File

@ -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
)