-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b54d19
commit 61f26bf
Showing
1 changed file
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Create Release - Stable | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
changelog: | ||
description: 'Changelog' | ||
required: true | ||
type: string | ||
|
||
permissions: | ||
actions: read | ||
contents: write | ||
|
||
jobs: | ||
create-release: | ||
name: Create stable apworld | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set current date to env | ||
run: | | ||
echo "CURRENT_DATE=$(date +'%Y%m%d')" >> "$GITHUB_ENV" | ||
echo "CURRENT_DATE_VERSION=$(date +'%Y%m%d')" >> "$GITHUB_ENV" | ||
- name: Set expected file basename to env | ||
run: echo "BASENAME=manual_stable_${{ env.CURRENT_DATE }}" >> "$GITHUB_ENV" | ||
- name: Format changelog input as multiline string and put into env | ||
run: | | ||
echo 'CHANGELOG<<EOF' >> "$GITHUB_ENV" | ||
echo "This stable release contains the following changes:\n\n" >> "$GITHUB_ENV" | ||
echo "${{ github.event.inputs.changelog }}" >> "$GITHUB_ENV" | ||
echo "\n\nAs always, report any bugs in our Discord!" | ||
echo 'EOF' >> "$GITHUB_ENV" | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Change game name and player name to standard names for Manual releases | ||
run: | | ||
tmp=$(mktemp) | ||
jq '.game = "Stable" | .player = "${{ env.CURRENT_DATE }}"' src/data/game.json > "$tmp" | ||
mv "$tmp" src/data/game.json | ||
- name: Create apworld file | ||
# rename src folder, zip it, change extension | ||
run: | | ||
mv src ${{ env.BASENAME }} | ||
zip -r ${{ env.BASENAME }}.zip ${{ env.BASENAME }}/* | ||
mv ${{ env.BASENAME }}.zip ${{ env.BASENAME }}.apworld | ||
- name: Upload apworld as an artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.BASENAME }}.apworld | ||
path: ${{ env.BASENAME }}.apworld | ||
if-no-files-found: error | ||
- name: Add Changelog text to a file for release body, to preserve newlines | ||
run: echo -en "${{ env.CHANGELOG }}" > bodyFile.txt | ||
- name: Create an stable release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: "Stable - ${{ env.CURRENT_DATE_VERSION }}" | ||
bodyFile: bodyFile.txt | ||
tag: ${{ env.BASENAME }} | ||
commit: main | ||
artifacts: "${{ env.BASENAME }}.apworld" |