-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (128 loc) Β· 3.93 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
on: # yamllint disable-line rule:truthy
push: ~
workflow_dispatch: ~
schedule:
- cron: '0 0 * * SAT' # Monday-Friday at 6:30 AM (AEST)
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- id: checkout
name: Checkout code π
uses: actions/checkout@v4
- id: yamllint
name: Run yamllint π
uses: ibiqlik/action-yamllint@v3
with:
strict: true
update-doc:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- id: checkout
name: Checkout code π
uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- id: auto-doc
name: Run auto-doc π
uses: tj-actions/[email protected]
with:
filename: "action.yaml"
- id: changes
name: Verify changed files π
uses: tj-actions/verify-changed-files@v20
with:
files: |
README.md
- id: commit
if: steps.changes.outputs.files_changed == 'true'
name: Commit README changes π₯
uses: EndBug/add-and-commit@v9
with:
message: 'Update README'
committer_name: 'GitHub Actions'
committer_email: '[email protected]'
add: 'README.md'
push:
runs-on: ubuntu-latest
name: Build and Push Container Image
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Log into the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=pr
- name: Build and push the Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release:
needs:
- yamllint
- push
runs-on: ubuntu-latest
if: ${{ github.ref_name == github.event.repository.default_branch }}
permissions:
contents: write
steps:
- id: checkout
name: Checkout code π
uses: actions/checkout@v4
- id: version
name: Calculate next version π’
uses: reecetech/[email protected]
with:
scheme: semver
increment: minor
- id: github-release
name: Create Github Release π¦
uses: softprops/[email protected]
with:
tag_name: ${{ steps.version.outputs.v-version }}
prerelease: false
draft: false
token: ${{ secrets.GITHUB_TOKEN }}
- id: push-short-tag
name: Create release short tag π·
uses: richardsimko/[email protected]
with:
tag_name: ${{ steps.version.outputs.major-v-version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: output-version
name: Version noted summary page π
shell: bash
run: |
set -euo pipefail
echo -e "## β¨ Published\n" | \
tee -a "${GITHUB_STEP_SUMMARY}"
echo -e "Name: ${{ github.event.repository.name }}\n" | \
tee -a "${GITHUB_STEP_SUMMARY}"
echo -e "Version: ${{ steps.version.outputs.v-version }}\n" | \
tee -a "${GITHUB_STEP_SUMMARY}"
echo -e "Moved tag: ${{ steps.version.outputs.major-v-version }}\n" \
| tee -a "${GITHUB_STEP_SUMMARY}"