Skip to content

Create Release - Stable #1

Create Release - Stable

Create Release - Stable #1

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"