forked from klakegg/docker-hugo
-
Notifications
You must be signed in to change notification settings - Fork 3
150 lines (128 loc) · 4.69 KB
/
build.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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Docker Image build CI
on:
pull_request:
branches:
- master
push:
branches:
- release/*
workflow_dispatch:
permissions:
contents: write
pull-requests: write
discussions: write
issues: write
jobs:
build:
runs-on: floryn90-runners
steps:
- name: Install curl & gpg
shell: bash
run: sudo apt update && sudo apt -y install curl gpg jq git && sudo apt clean
- name: Clean Workspace
uses: AutoModality/action-clean@v1
- name: Checkout
uses: actions/checkout@v4
- name: Install build essential
shell: bash
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt-get install dirmngr -y
sudo apt-get update
sudo apt-get install gh build-essential wget -y
sudo apt-get autoclean
sudo apt-get autoremove
sudo rm -rf /var/lib/apt/lists/*
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker login
uses: docker/login-action@v3
with:
username: floryn90
password: ${{ secrets.DOCKER_TOKEN }}
- name: Get previous release tag
id: release_tag
shell: bash
run: |
releases=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/gohugoio/hugo/releases?per_page=1&page=1)
release_tag=$(echo $releases | jq '.[0].tag_name' | sed 's/v//g' | sed 's/"//g')
echo "Latest release tag is ${release_tag}"
echo "latest_release_tag=${release_tag}" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.TOKEN_GITHUB }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: floryn90/hugo
# tags: |
# type=raw,value=base
# type=raw,value=alpine
# type=raw,value=alpine-ci
# type=raw,value=alpine-onbuild
# type=raw,value=asciidoctor
# type=raw,value=asciidoctor-ci
# type=raw,value=asciidoctor-onbuild
# type=raw,value=pandoc
# type=raw,value=pandoc-ci
# type=raw,value=pandoc-onbuild
# type=raw,value=ext-alpine
# type=raw,value=ext-alpine-ci
# type=raw,value=ext-alpine-onbuild
# type=raw,value=ext-asciidoctor
# type=raw,value=ext-asciidoctor-ci
# type=raw,value=ext-asciidoctor-onbuild
# type=raw,value=ext-pandoc
# type=raw,value=ext-pandoc-ci
# type=raw,value=ext-pandoc-onbuild
# type=raw,value=busybox
# type=raw,value=busybox-ci
# type=raw,value=busybox-onbuild
# type=raw,value=debian
# type=raw,value=debian-ci
# type=raw,value=debian-onbuild
# type=raw,value=ext-debian
# type=raw,value=latest-ext
# type=raw,value=ext-debian-ci
# type=raw,value=ext-debian-onbuild
# type=raw,value=ext-ci
# type=raw,value=ext-onbuild
# type=raw,value=ubuntu
# type=raw,value=ubuntu-ci
# type=raw,value=ubuntu-onbuild
# type=raw,value=ext-ubuntu-ci
# type=raw,value=ext-ubuntu-onbuild
- name: Prepare
shell: bash
run: make prepare
- name: Build
shell: bash
run: make build
# Compare the image built in the pull request with the one in production
# - name: Docker Scout
# id: docker-scout
# uses: docker/scout-action@v1
# with:
# image: ${{ steps.meta.outputs.tags }}
# command: cves,quickview,compare
# to: docker.io/${{ steps.meta.outputs.tags }}
# ignore-unchanged: true
# only-severities: critical,high
# organization: floryn90
# github-token: ${{ github.token }}
- name: Upload target content
uses: actions/upload-artifact@v4
with:
name: target
path: target
# - name: Test Docsy
# run: sudo make test-docsy
# - name: Test DocuAPI
# run: sudo make test-docuapi
- name: Push edge images
if: "!startsWith(github.ref, 'refs/tags/')"
shell: bash
run: make push-edge