-
Notifications
You must be signed in to change notification settings - Fork 3
122 lines (107 loc) · 3.73 KB
/
publish.yaml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Publish Web Page, and Docker Image, and Release.
on:
pull_request:
branches:
- main
types: [closed]
jobs:
publish:
runs-on: ubuntu-latest
if: startsWith(github.head_ref, 'release/v') && github.event.pull_request.merged == true
env:
REPO: https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git
steps:
# Checkout the project, and get tag name.
- name: Checkout
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Initialize git
shell: bash
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Get tag name
id: vars
run: |
HEAD_REF=${{ github.head_ref }}
echo "::set-output name=tag::${HEAD_REF##*/v}"
# setup java, hugo, and docker.
- name: Set up JDK 11 for pochi core libraries
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.85.0'
extended: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Build packages, site, distribution file
- name: Build
run: |
bash ./bin/setup_project.sh
POCHI_HOME=$PWD mvn package
mkdir lib
cp pochi-cmd/target/*.jar lib
- name: Build Site
run: |
bash ./bin/build_site.sh
- name: Build Dist
run:
bash ./bin/make_dist.sh
- name: Create release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.vars.outputs.tag }}
release_name: Release v${{ steps.vars.outputs.tag }}
draft: false
prerelease: false
# Publish release
- name: Upload release assets
id: upload-release-assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_path: ./dist/pochi-${{ steps.vars.outputs.tag }}.zip
asset_name: pochi-${{ steps.vars.outputs.tag }}.zip
asset_content_type: application/zip
upload_url: ${{ steps.create_release.outputs.upload_url }}
# Publish Docker image to ghcr.io
- name: Deploy GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site/public
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker Images (without Groovy)
uses: docker/build-push-action@v2
with:
context: dockers/pochi
push: true
tags: |
ghcr.io/tamada/pochi:${{ steps.vars.outputs.tag }}
ghcr.io/tamada/pochi:latest
- name: Push Docker Images (with Groovy)
uses: docker/build-push-action@v2
with:
context: dockers/pochi-groovysh
push: true
tags: |
ghcr.io/tamada/pochi-groovysh:${{ steps.vars.outputs.tag }}
ghcr.io/tamada/pochi-groovysh:latest