Create Release - Unstable #26
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
name: Create Release - Unstable | |
on: | |
workflow_dispatch: | |
inputs: | |
changelog: | |
description: 'Changelog' | |
required: true | |
type: string | |
permissions: | |
actions: read | |
contents: write | |
jobs: | |
create-release: | |
name: Create unstable 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_unstable_${{ env.CURRENT_DATE }}" >> "$GITHUB_ENV" | |
- name: Format changelog input as multiline string and put into env | |
run: | | |
echo 'CHANGELOG<<EOF' >> "$GITHUB_ENV" | |
echo "This unstable release contains the following changes:\n\n" >> "$GITHUB_ENV" | |
echo "${{ github.event.inputs.changelog }}" >> "$GITHUB_ENV" | |
echo "\n\nAs always, please try out these changes and report any bugs in our Discord!" | |
echo 'EOF' >> "$GITHUB_ENV" | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Change game name and creator name to standard names for Manual releases | |
run: | | |
tmp=$(mktemp) | |
jq '.game = "Unstable" | .creator = "${{ 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 unstable release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: "Unstable - ${{ env.CURRENT_DATE_VERSION }}" | |
bodyFile: bodyFile.txt | |
tag: ${{ env.BASENAME }} | |
commit: ${{ env.GITHUB_REF }} | |
artifacts: "${{ env.BASENAME }}.apworld" |