1+ # name: Weekly Release
2+ #
3+ # permissions:
4+ # contents: write
5+ # pull-requests: write
6+ #
7+ # on:
8+ # workflow_dispatch:
9+ # inputs:
10+ # build_notes:
11+ # description: 'Build notes (optional)'
12+ # required: false
13+ # default: ''
14+ # type: string
15+ # known_issues:
16+ # description: 'Known issues (optional)'
17+ # required: false
18+ # default: ''
19+ # type: string
20+ # force_changed:
21+ # description: 'Force build'
22+ # required: false
23+ # default: 'false'
24+ # type: choice
25+ # options:
26+ # - 'false'
27+ # - 'true'
28+ # pre-release:
29+ # description: 'Mark release as pre-release'
30+ # required: false
31+ # default: 'false'
32+ # type: choice
33+ # options:
34+ # - 'false'
35+ # - 'true'
36+ #
37+ # schedule:
38+ # - cron: '0 9 * * 5'
39+ #
40+ # concurrency:
41+ # group: ${{ github.workflow }}-${{ github.ref }}
42+ # cancel-in-progress: true
43+ #
44+ # jobs:
45+ # get-date:
46+ # runs-on: ubuntu-latest
47+ # outputs:
48+ # date: ${{ steps.date.outputs.date }}
49+ # steps:
50+ # - name: Get current date
51+ # id: date
52+ # run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
53+ #
54+ # detect-scm-changes:
55+ # needs: [get-date]
56+ # runs-on: ubuntu-latest
57+ # outputs:
58+ # changed: ${{ steps.check.outputs.changed }}
59+ # steps:
60+ # - uses: actions/checkout@v4
61+ # with:
62+ # fetch-depth: 0
63+ # fetch-tags: true
64+ # - id: check
65+ # run: |
66+ # if [ "${{ github.event.inputs.force_changed }}" = "true" ]; then
67+ # echo "changed=true" >> $GITHUB_OUTPUT
68+ # exit 0
69+ # fi
70+ #
71+ # echo LAST TAG:
72+ # git describe --tags --abbrev=0 2>/dev/null || echo ""
73+ #
74+ # LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
75+ # if [ -z "$LAST_TAG" ]; then
76+ # echo "changed=true" >> $GITHUB_OUTPUT
77+ # exit 0
78+ # fi
79+ # CHANGED=$(git diff --name-only $LAST_TAG..HEAD | grep -v '.github/workflows/' | wc -l)
80+ # if [ "$CHANGED" -eq "0" ]; then
81+ # echo "changed=false" >> $GITHUB_OUTPUT
82+ # else
83+ # echo "changed=true" >> $GITHUB_OUTPUT
84+ # fi
85+ #
86+ # build-generals:
87+ # needs: [detect-scm-changes, get-date]
88+ # if: needs.detect-scm-changes.outputs.changed == 'true'
89+ # name: Build Generals${{ matrix.preset && '' }}
90+ # strategy:
91+ # matrix:
92+ # include:
93+ # - preset: "vc6-weekly"
94+ # tools: true
95+ # extras: false
96+ # release: true
97+ # fail-fast: false
98+ # uses: ./.github/workflows/build-toolchain.yml
99+ # with:
100+ # game: "Generals"
101+ # preset: ${{ matrix.preset }}
102+ # tools: ${{ matrix.tools }}
103+ # extras: ${{ matrix.extras }}
104+ # secrets: inherit
105+ #
106+ # build-generalsmd:
107+ # needs: [detect-scm-changes, get-date]
108+ # if: needs.detect-scm-changes.outputs.changed == 'true'
109+ # name: Build GeneralsMD${{ matrix.preset && '' }}
110+ # strategy:
111+ # matrix:
112+ # include:
113+ # - preset: "vc6-weekly"
114+ # tools: true
115+ # extras: false
116+ # release: true
117+ # fail-fast: false
118+ # uses: ./.github/workflows/build-toolchain.yml
119+ # with:
120+ # game: "GeneralsMD"
121+ # preset: ${{ matrix.preset }}
122+ # tools: ${{ matrix.tools }}
123+ # extras: ${{ matrix.extras }}
124+ # secrets: inherit
125+ #
126+ # create-release:
127+ # name: Create Release
128+ # needs: [build-generals, build-generalsmd, get-date]
129+ # runs-on: ubuntu-latest
130+ # steps:
131+ # - name: Checkout repository
132+ # uses: actions/checkout@v4
133+ # with:
134+ # fetch-depth: 0
135+ # fetch-tags: true
136+ #
137+ # - name: Collect commits since last release
138+ # id: changelog
139+ # run: |
140+ # LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
141+ # if [ -z "$LAST_TAG" ]; then
142+ # CHANGELOG_COMMITS=$(git log --pretty="format:- %s" --no-merges HEAD | head -n 10 || true)
143+ # else
144+ # CHANGELOG_COMMITS=$(git log --pretty="format:- %s" --no-merges "$LAST_TAG"..HEAD || true)
145+ # fi
146+ # if [ -z "$CHANGELOG_COMMITS" ]; then
147+ # CHANGELOG_COMMITS="- No relevant changes detected since the last release."
148+ # fi
149+ # {
150+ # echo 'commits<<CHANGELOG_EOF'
151+ # echo "$CHANGELOG_COMMITS"
152+ # echo 'CHANGELOG_EOF'
153+ # } >> "$GITHUB_OUTPUT"
154+ #
155+ # # Generals vc6
156+ # - name: Download Generals VC6 Artifacts
157+ # uses: actions/download-artifact@v4
158+ # with:
159+ # name: Generals-vc6-weekly+t
160+ # path: generals-vc6-artifacts
161+ #
162+ # - name: Prepare and Zip Generals VC6
163+ # run: |
164+ # zip -jr generals-weekly-${{ needs.get-date.outputs.date }}.zip generals-vc6-artifacts/*
165+ #
166+ # # GeneralsMD vc6
167+ # - name: Download GeneralsMD VC6 Artifacts
168+ # uses: actions/download-artifact@v4
169+ # with:
170+ # name: GeneralsMD-vc6-weekly+t
171+ # path: generalsmd-vc6-artifacts
172+ #
173+ # - name: Prepare and Zip GeneralsMD VC6
174+ # run: |
175+ # zip -jr generalszh-weekly-${{ needs.get-date.outputs.date }}.zip generalsmd-vc6-artifacts/*
176+ #
177+ # - name: Generate release notes
178+ # id: release_body
179+ # run: |
180+ # BODY=""
181+ # if [ "${{ github.event.inputs.build_notes }}" != "" ]; then
182+ # BODY="${BODY}### Build notes\n${{ github.event.inputs.build_notes }}\n"
183+ # fi
184+ # if [ "${{ github.event.inputs.known_issues }}" != "" ]; then
185+ # BODY="${BODY}### Known issues\n${{ github.event.inputs.known_issues }}\n"
186+ # fi
187+ # BODY="${BODY}### Changelog\n${{ steps.changelog.outputs.commits }}"
188+ # echo "body<<EOF" >> $GITHUB_OUTPUT
189+ # echo -e "$BODY" >> $GITHUB_OUTPUT
190+ # echo "EOF" >> $GITHUB_OUTPUT
191+ #
192+ # - name: Create GitHub Release
193+ # uses: softprops/action-gh-release@v2
194+ # with:
195+ # tag_name: weekly-${{ needs.get-date.outputs.date }}
196+ # name: weekly-${{ needs.get-date.outputs.date }}
197+ # prerelease: ${{ github.event.inputs.pre-release == 'true' }}
198+ # body: ${{ steps.release_body.outputs.body }}
199+ # files: |
200+ # generals-weekly-${{ needs.get-date.outputs.date }}.zip
201+ # generalszh-weekly-${{ needs.get-date.outputs.date }}.zip
202+ # env:
203+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
204+ #
205+ # - name: Clean up release folders
206+ # if: always()
207+ # run: |
208+ # rm -rf generals-vc6-artifacts generalsmd-vc6-artifacts
209+ # rm -f generals-weekly-${{ needs.get-date.outputs.date }}.zip
210+ # rm -f generalszh-weekly-${{ needs.get-date.outputs.date }}.zip
211+ #
0 commit comments