-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (133 loc) · 5.49 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
on:
pull_request:
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=false
fi
elif [ ${{ matrix.name }} == 'preview' ]; then
if [ ${{ needs.versioning.outputs.preview }} == ${{ needs.versioning.outputs.stable }} ]; then
SHOULD_SEMVER=false
fi
if [ ${{ needs.versioning.outputs.preview }} == ${{ needs.versioning.outputs.development }} ]; then
SHOULD_SEMVER=false
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 }}
Report:
runs-on: ubuntu-latest
needs: [ build, versioning ]
steps:
- uses: actions/checkout@v4
- name: Create or Update README.md
run: |
if [[ "${{ needs.versioning.outputs.stable }}" == "${{ needs.versioning.outputs.development }}" ]]; then
echo "SHOULD_SEMVER_DEVELOPMENT=true" >> $GITHUB_ENV
else
echo "SHOULD_SEMVER_DEVELOPMENT=false" >> $GITHUB_ENV
fi
if [[ "${{ needs.versioning.outputs.stable }}" == "${{ needs.versioning.outputs.preview }}" ]] || [[ "${{ needs.versioning.outputs.development }}" == "${{ needs.versioning.outputs.preview }}" ]]; then
echo "SHOULD_SEMVER_PREVIEW=true" >> $GITHUB_ENV
else
echo "SHOULD_SEMVER_PREVIEW=false" >> $GITHUB_ENV
fi
rm -f README.md
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 "## Version" >> 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
echo "- `ghcr.io/urothis/nwserver:${{ needs.versioning.outputs.stable }}`" >> README.md
echo "- `urothis/nwserver:${{ needs.versioning.outputs.stable }}`" >> README.md
echo "- `ghcr.io/urothis/nwserver:stable`" >> README.md
echo "- `urothis/nwserver:stable`" >> README.md
echo "" >> README.md
echo "## Development" >> README.md
echo "\`${{ needs.versioning.outputs.development }}\`" >> README.md
echo "" >> README.md
echo "Tags: " >> README.md
echo "" >> README.md
if [[ "${{ env.SHOULD_SEMVER_DEVELOPMENT }}" == "true" ]]; then
echo "- `ghcr.io/urothis/nwserver:${{ needs.versioning.outputs.development }}`" >> README.md
echo "- `urothis/nwserver:${{ needs.versioning.outputs.development }}`" >> README.md
fi
echo "- `ghcr.io/urothis/nwserver:development`" >> README.md
echo "- `urothis/nwserver:development`" >> README.md
echo "" >> README.md
echo "## Preview" >> README.md
echo "\`${{ needs.versioning.outputs.preview }}\`" >> README.md
echo "" >> README.md
echo "Tags: " >> README.md
echo "" >> README.md
if [[ "${{ env.SHOULD_SEMVER_PREVIEW }}" == "true" ]]; then
echo "- `ghcr.io/urothis/nwserver:${{ needs.versioning.outputs.preview }}`" >> README.md
echo "- `urothis/nwserver:${{ needs.versioning.outputs.preview }}`" >> README.md
fi
echo "- `ghcr.io/urothis/nwserver:preview`" >> README.md
echo "- `urothis/nwserver:preview`" >> README.md
- 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.md"]'
message: "Update README.md"
author_name: urothis
author_email: urothis@gmail.com
github_token: ${{ secrets.GH_ACCESS_TOKEN }}