-
Notifications
You must be signed in to change notification settings - Fork 16
92 lines (81 loc) · 2.27 KB
/
build_and_publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Build and Archive
on:
push:
tags: v*
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build_website:
name: Build Main Website Documentation
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@v4
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@v4
with:
name: website
path: ./public
create_release:
if: startsWith(github.ref, 'refs/tags/')
name: Archive and Published Tagged Build
runs-on: ubuntu-latest
needs: [build_website]
steps:
- 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
if: startsWith(github.ref, 'refs/tags/')
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: website
- 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: ./website
asset_name: website.zip
asset_content_type: application/zip
if: startsWith(github.ref, 'refs/tags/')