-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (158 loc) · 6.35 KB
/
nwserver.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
151
152
153
154
155
156
157
158
159
160
161
name: 🚀 Generate Docker Images
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
versioning:
runs-on: ubuntu-latest
outputs:
stable: ${{ steps.version.outputs.stable }}
development: ${{ steps.version.outputs.development }}
preview: ${{ steps.version.outputs.preview }}
json: ${{ steps.version.outputs.json }}
steps:
- uses: actions/checkout@v4
- name: version
id: version
uses: ./.github/actions/version/
with:
steam_username: ${{ secrets.STEAM_USER }}
steam_password: ${{ secrets.STEAM_PASS }}
build:
runs-on: ubuntu-latest
needs: versioning
strategy:
matrix:
include:
- name: stable
env:
SEMVER: ${{ needs.versioning.outputs.stable }}
- name: development
env:
SEMVER: ${{ needs.versioning.outputs.development }}
- name: preview
env:
SEMVER: ${{ needs.versioning.outputs.preview }}
steps:
- uses: actions/checkout@v4
- name: should_semver
run: |
SHOULD_SEMVER=false
if [ ${{ matrix.name }} == 'stable' ]; then
SHOULD_SEMVER=true
elif [ ${{ matrix.name }} == 'development' ]; then
if [ ${{ needs.versioning.outputs.stable }} != ${{ needs.versioning.outputs.development }} ]; then
SHOULD_SEMVER=true
fi
elif [ ${{ matrix.name }} == 'preview' ]; then
if [ ${{ needs.versioning.outputs.preview }} != ${{ needs.versioning.outputs.stable }} ]; then
SHOULD_SEMVER=true
fi
if [ ${{ needs.versioning.outputs.preview }} != ${{ needs.versioning.outputs.development }} ]; then
SHOULD_SEMVER=true
fi
fi
echo "SHOULD_SEMVER=$SHOULD_SEMVER" >> $GITHUB_ENV
- name: NWNEE
id: nwn
uses: ./.github/actions/nwserver/
with:
steam_username: ${{ secrets.STEAM_USER }}
steam_password: ${{ secrets.STEAM_PASS }}
channel: ${{ matrix.name }}
tag_semver: ${{ env.SHOULD_SEMVER }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
gh_access_token: ${{ secrets.GH_ACCESS_TOKEN }}
Report:
runs-on: ubuntu-latest
needs: [ build, versioning ]
steps:
- uses: actions/checkout@v4
- name: Create or Update README.md
env:
STABLE: ${{ needs.versioning.outputs.stable }}
DEVELOPMENT: ${{ needs.versioning.outputs.development }}
PREVIEW: ${{ needs.versioning.outputs.preview }}
run: |
ADDITIONAL_TAGS=("" "-buster" "-bullseye" "-bookworm")
REGISTRIES=("ghcr.io/urothis/nwserver" "urothis/nwserver")
if [[ "$STABLE" != "$DEVELOPMENT" ]]; then
export SHOULD_SEMVER_DEVELOPMENT="true"
else
export SHOULD_SEMVER_DEVELOPMENT="false"
fi
if [[ "$STABLE" != "$PREVIEW" ]] || [[ "$DEVELOPMENT" != "$PREVIEW" ]]; then
export "SHOULD_SEMVER_PREVIEW="true"
else
export "SHOULD_SEMVER_PREVIEW="false"
fi
echo "# <b>nwserver</b>" > README.md
echo "" >> README.md
echo now=$(date '+%Y%m%d') >> $GITHUB_OUTPUT
echo "Last Updated: \`$(date)\`" >> README.md
echo "" >> README.md
echo "## Overview:" >> README.md
echo "This repository automates the Docker build process for nwserver and distributing the built images across multiple registries. Daily builds are performed to ensure that the images are up to date with the latest version of nwserver. The images are built using the latest version of nwserver available on Steam." >> README.md
echo "The images are built for the following platforms:" >> README.md
echo "" >> README.md
echo "- \`linux/amd64\`" >> README.md
echo "- \`linux/arm64\`" >> README.md
echo "" >> README.md
echo "### Stable" >> README.md
echo "\`${{ needs.versioning.outputs.stable }}\`" >> README.md
echo "" >> README.md
echo "Tags: " >> README.md
echo "" >> README.md
for registry in "${REGISTRIES[@]}"; do
for tag in "${ADDITIONAL_TAGS[@]}"; do
echo "- \`${registry}:stable$tag\`" >> README.md
echo "- \`${registry}:${{ needs.versioning.outputs.stable }}$tag\`" >> README.md
done
echo "---" >> README.md
done
echo "" >> README.md
echo "### Development" >> README.md
echo "\`${{ needs.versioning.outputs.development }}\`" >> README.md
echo "" >> README.md
echo "Tags: " >> README.md
echo "" >> README.md
for registry in "${REGISTRIES[@]}"; do
for tag in "${ADDITIONAL_TAGS[@]}"; do
echo "- \`${registry}:development$tag\`" >> README.md
if [[ "$SHOULD_SEMVER_DEVELOPMENT" == "true" ]]; then
echo "- \`${registry}:${{ needs.versioning.outputs.development }}$tag\`" >> README.md
fi
done
echo "---" >> README.md
done
echo "" >> README.md
echo "### Preview" >> README.md
echo "\`${{ needs.versioning.outputs.preview }}\`" >> README.md
echo "" >> README.md
echo "Tags: " >> README.md
echo "" >> README.md
for registry in "${REGISTRIES[@]}"; do
for tag in "${ADDITIONAL_TAGS[@]}"; do
echo "- \`${registry}:preview$tag\`" >> README.md
if [[ "$SHOULD_SEMVER_PREVIEW" == "true" ]]; then
echo "- \`${registry}:${{ needs.versioning.outputs.preview }}$tag\`" >> README.md
fi
done
echo "---" >> README.md
done
- name: Install jq
run: sudo apt-get install -y jq
- name: write version json to file
run: |
rm -f version.json
echo '${{ needs.versioning.outputs.json }}' | jq . > version.json
- name: Commit updated Files
uses: EndBug/add-and-commit@v9
with:
add: '["README.md", "version.json"]'
message: "Update README.md"
author_name: urothis
author_email: urothis@gmail.com
github_token: ${{ secrets.GH_ACCESS_TOKEN }}