Skip to content

Commit a7e5d6a

Browse files
authored
pub: add publishing workflow (#33)
* Remove old jenkins build * Add new GH action for publishing * Add license file * Update readme
1 parent f3a91c8 commit a7e5d6a

File tree

4 files changed

+388
-130
lines changed

4 files changed

+388
-130
lines changed

.github/workflows/publish.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
2+
name: Deploy Website
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["master"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Allow one concurrent deployment
13+
concurrency:
14+
group: "publish"
15+
cancel-in-progress: true
16+
17+
env:
18+
WEBSITE_SOURCES_DIR: sources
19+
WEBSITE_CONTENT_REPO: eclipse-emfcloud/emfcloud-website
20+
WEBSITE_CONTENT_DIR: hugo-public-dist
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
with:
28+
submodules: recursive
29+
fetch-depth: 0
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
path: ${{ env.WEBSITE_SOURCES_DIR }}
32+
- name: Checkout content website
33+
uses: actions/checkout@v3
34+
with:
35+
repository: ${{ env.WEBSITE_CONTENT_REPO }}
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
path: ${{ env.WEBSITE_CONTENT_DIR }}
38+
39+
- name: Setup Hugo
40+
uses: peaceiris/actions-hugo@v2
41+
with:
42+
hugo-version: '0.78.1'
43+
extended: true
44+
45+
- name: Prune current content
46+
working-directory: ${{ env.WEBSITE_CONTENT_DIR }}
47+
run: git rm -rf *
48+
49+
- name: Build website
50+
working-directory: ${{ env.WEBSITE_SOURCES_DIR }}
51+
env:
52+
# For maximum backward compatibility with Hugo modules
53+
HUGO_ENVIRONMENT: production
54+
HUGO_ENV: production
55+
run: hugo --minify -d ${{ github.workspace }}/${{ env.WEBSITE_CONTENT_DIR }}
56+
57+
- name: Check for content changes
58+
id: git-check
59+
working-directory: ${{ env.WEBSITE_CONTENT_DIR }}
60+
run: |
61+
git add -A
62+
echo ::set-output name=modified::$(if git diff --cached --exit-code --quiet; then echo "false"; else echo "true"; fi)
63+
- name: Push content changes
64+
if: steps.git-check.outputs.modified == 'true'
65+
working-directory: ${{ env.WEBSITE_CONTENT_DIR }}
66+
run: |
67+
git config user.name ${{ github.event.head_commit.author.name }}
68+
git config user.email ${{ github.event.head_commit.author.email }}
69+
git config -l | grep 'http\..*\.extraheader' | cut -d= -f1 | xargs -L1 git config --unset-all
70+
git remote set-url origin https://x-access-token:${{ secrets.GH_ACTION_TOKEN }}@github.com/${{ env.WEBSITE_CONTENT_REPO }}
71+
git commit -am "${{ github.event.head_commit.message }}"
72+
git push origin

Jenkinsfile

-118
This file was deleted.

0 commit comments

Comments
 (0)