2023-07-31 06:37:57 -06:00
|
|
|
name: Deploy to GitHub
|
2023-07-31 04:56:26 -06:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
2023-08-19 00:34:37 -06:00
|
|
|
- '*-r*'
|
2023-08-01 01:11:46 -06:00
|
|
|
|
2023-07-31 04:56:26 -06:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2023-08-01 01:11:46 -06:00
|
|
|
ref:
|
|
|
|
description: Tag
|
2023-07-31 04:56:26 -06:00
|
|
|
required: true
|
|
|
|
|
|
|
|
jobs:
|
2023-08-05 01:58:09 -06:00
|
|
|
package:
|
|
|
|
uses: ./.github/workflows/package.yml
|
2023-07-31 04:56:26 -06:00
|
|
|
with:
|
2023-08-03 02:09:57 -06:00
|
|
|
dfhack_ref: ${{ github.event.inputs && github.event.inputs.ref || github.event.ref }}
|
2023-08-05 01:58:09 -06:00
|
|
|
append-date-and-hash: false
|
2023-07-31 04:56:26 -06:00
|
|
|
cache-readonly: true
|
2023-07-31 05:51:44 -06:00
|
|
|
launchdf: true
|
2023-07-31 04:56:26 -06:00
|
|
|
secrets: inherit
|
|
|
|
|
|
|
|
create-update-release:
|
2023-07-31 06:37:57 -06:00
|
|
|
name: Draft GitHub release
|
2023-08-05 01:58:09 -06:00
|
|
|
needs: package
|
2023-07-31 04:56:26 -06:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
steps:
|
2023-08-19 00:46:12 -06:00
|
|
|
- name: Install doc dependencies
|
|
|
|
run: pip install 'sphinx<4.4.0'
|
2023-07-31 04:56:26 -06:00
|
|
|
- name: Clone DFHack
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
2023-08-01 01:11:46 -06:00
|
|
|
ref: ${{ github.event.inputs && github.event.inputs.ref || github.event.ref }}
|
2023-07-31 05:43:43 -06:00
|
|
|
submodules: true
|
2023-07-31 05:51:44 -06:00
|
|
|
- name: Get tag
|
|
|
|
id: gettag
|
2023-08-19 03:32:13 -06:00
|
|
|
run: |
|
|
|
|
TAG=$(git describe --tags --abbrev=0 --exact-match)
|
|
|
|
echo name="$TAG" >> $GITHUB_OUTPUT
|
2023-09-06 16:25:13 -06:00
|
|
|
echo type=$(echo "$TAG" | egrep 'r[0-9]+$' && echo "release" || echo "prerelease") >> $GITHUB_OUTPUT
|
2023-07-31 05:43:43 -06:00
|
|
|
- name: Generate release text
|
|
|
|
run: |
|
|
|
|
python docs/gen_changelog.py -a
|
2023-08-19 00:34:37 -06:00
|
|
|
CHANGELOG_FILE=docs/changelogs/${{ steps.gettag.outputs.name }}-github.txt
|
|
|
|
if ! test -f $CHANGELOG_FILE; then CHANGELOG_FILE=docs/changelogs/future-github.txt; fi
|
2023-07-31 05:43:43 -06:00
|
|
|
TOKEN_LINE=$(grep -Fhne '%RELEASE_NOTES%' .github/release_template.md | sed 's/:.*//')
|
|
|
|
head -n $((TOKEN_LINE - 1)) .github/release_template.md > release_body.md
|
2023-08-19 00:34:37 -06:00
|
|
|
CHANGELOG_LINES=$(wc -l <$CHANGELOG_FILE)
|
2023-10-17 02:39:27 -06:00
|
|
|
tail -n $((CHANGELOG_LINES - 4)) $CHANGELOG_FILE >> release_body.md
|
2023-10-17 02:24:20 -06:00
|
|
|
tail -n 1 .github/release_template.md >> release_body.md
|
2023-07-31 05:43:43 -06:00
|
|
|
cat release_body.md
|
2023-08-05 01:58:09 -06:00
|
|
|
- name: Stage release
|
2023-07-31 04:56:26 -06:00
|
|
|
uses: actions/download-artifact@v3
|
2023-08-19 01:32:36 -06:00
|
|
|
- name: Prep artifacts
|
2023-07-31 04:56:26 -06:00
|
|
|
run: |
|
2023-08-19 01:32:36 -06:00
|
|
|
mkdir artifacts
|
2023-08-05 01:58:09 -06:00
|
|
|
cd dfhack-windows64-build
|
2023-08-19 01:32:36 -06:00
|
|
|
tar xjf dfhack-windows64-build.tar.bz2
|
|
|
|
rm dfhack-windows64-build.tar.bz2
|
2023-08-19 01:09:16 -06:00
|
|
|
zip -qr ../artifacts/dfhack-${{ steps.gettag.outputs.name }}-Windows-64bit.zip .
|
2023-08-19 01:32:36 -06:00
|
|
|
cd ../dfhack-linux64-build
|
|
|
|
mv dfhack-linux64-build.tar.bz2 ../artifacts/dfhack-${{ steps.gettag.outputs.name }}-Linux-64bit.tar.bz2
|
2023-07-31 04:56:26 -06:00
|
|
|
- name: Create or update GitHub release
|
|
|
|
uses: ncipollo/release-action@v1
|
|
|
|
with:
|
2023-08-19 01:09:16 -06:00
|
|
|
artifacts: "artifacts/dfhack-*"
|
2023-07-31 05:43:43 -06:00
|
|
|
bodyFile: "release_body.md"
|
2023-07-31 04:56:26 -06:00
|
|
|
allowUpdates: true
|
|
|
|
artifactErrorsFailBuild: true
|
|
|
|
draft: true
|
2023-07-31 05:51:44 -06:00
|
|
|
name: "DFHack ${{ steps.gettag.outputs.name }}"
|
2023-07-31 04:56:26 -06:00
|
|
|
omitBodyDuringUpdate: true
|
|
|
|
omitDraftDuringUpdate: true
|
|
|
|
omitNameDuringUpdate: true
|
|
|
|
omitPrereleaseDuringUpdate: true
|
2023-08-19 03:32:13 -06:00
|
|
|
prerelease: ${{ steps.gettag.outputs.type == 'prerelease' }}
|
2023-07-31 04:56:26 -06:00
|
|
|
replacesArtifacts: true
|
2023-07-31 05:51:44 -06:00
|
|
|
tag: ${{ steps.gettag.outputs.name }}
|