Skip to content

Commit

Permalink
ci: Upgrade Hugo and create gh action
Browse files Browse the repository at this point in the history
Signed-off-by: Helio Chissini de Castro <[email protected]>
  • Loading branch information
heliocastro committed Dec 22, 2023
1 parent aa22da5 commit e7e38f3
Show file tree
Hide file tree
Showing 6 changed files with 1,095 additions and 5 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build and Archive
on:
push:
branches:
- main
workflow_dispatch:

jobs:
build-archive:
runs-on: ubuntu-latest
env:
PROJECT_NAME: sw360
PROJECT_BOT_NAME: SW360 Bot
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '>=1.21.5'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install postcss-cli
run: npm ci

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.111.3'
extended: true

- uses: actions/cache@v3
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugomod-
- name: Build SW360 Hugo
shell: bash
run: |
mkdir -p themes/docsy
hugo --minify -b 'https://www.eclipse.org/sw360/'
- name: Archive
uses: actions/upload-artifact@v2
with:
name: website
path: ./public

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./public
asset_name: website.zip
asset_content_type: application/zip

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ resources/
# Hugo tmporary dirs
public
.hugo_build.lock

# Nodejs
node_modules
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
- name: "HOME"
value: "/home/jenkins"
- name: hugo
image: klakegg/hugo:0.107.0-ext-ubuntu
image: klakegg/hugo:0.111.3-ext-ubuntu
command:
- cat
tty: true
Expand Down
2 changes: 1 addition & 1 deletion docker_serve_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ docker run \
--name sw360_website \
-p 1313:1313 \
"$@" \
klakegg/hugo:0.107.0-ext-ubuntu \
klakegg/hugo:0.111.3-ext-ubuntu \
server --verbose --verboseLog --debug --cleanDestinationDir \
--baseUrl http://localhost:1313/sw360
Loading

0 comments on commit e7e38f3

Please sign in to comment.