dfhack/.github/workflows/github-release.yml

97 lines
2.9 KiB
YAML

2023-07-31 06:37:57 -06:00
name: Deploy to GitHub
on:
push:
tags:
- '*-r[0-9]+'
2023-08-01 01:11:46 -06:00
workflow_dispatch:
inputs:
2023-08-01 01:11:46 -06:00
ref:
description: Tag
required: true
jobs:
package-win64:
2023-07-31 06:37:57 -06:00
name: Build win64 release
uses: ./.github/workflows/build-windows.yml
with:
artifact-name: win64-release
2023-08-01 01:11:46 -06:00
ref: ${{ github.event.inputs && github.event.inputs.ref || github.event.ref }}
cache-id: release
cache-readonly: true
2023-07-31 05:51:44 -06:00
launchdf: true
secrets: inherit
package-linux64:
2023-07-31 06:37:57 -06:00
name: Build linux64 release
uses: ./.github/workflows/build-linux.yml
with:
artifact-name: linux64-release
2023-08-03 01:57:55 -06:00
dfhack_ref: ${{ github.event.inputs && github.event.inputs.ref || github.event.ref }}
cache-id: release
cache-readonly: true
stonesense: true
docs: true
secrets: inherit
create-update-release:
2023-07-31 06:37:57 -06:00
name: Draft GitHub release
needs:
- package-win64
- package-linux64
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- 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
run: echo name=$(git describe --tags --abbrev=0 --exact-match) >> $GITHUB_OUTPUT
2023-07-31 05:43:43 -06:00
- name: Generate release text
run: |
python docs/gen_changelog.py -a
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-07-31 05:51:44 -06:00
CHANGELOG_LINES=$(wc -l <docs/changelogs/${{ steps.gettag.outputs.name }}-github.txt)
tail -n $((CHANGELOG_LINES - 3)) docs/changelogs/${{ steps.gettag.outputs.name }}-github.txt >> release_body.md
2023-07-31 05:43:43 -06:00
tail -n 2 .github/release_template.md >> release_body.md
cat release_body.md
- name: Stage win64 release
uses: actions/download-artifact@v3
with:
name: win64-release
path: win64
- name: Create win64 release archive
run: |
cd win64
2023-07-31 05:51:44 -06:00
zip -r ../dfhack-${{ steps.gettag.outputs.name }}-Windows-64bit.zip .
- name: Stage linux64 release
uses: actions/download-artifact@v3
with:
name: linux64-release
path: linux64
- name: Create linux64 release archive
run: |
cd linux64
2023-07-31 05:51:44 -06:00
tar cjf ../dfhack-${{ steps.gettag.outputs.name }}-Linux-64bit.tar.bz2 .
- name: Create or update GitHub release
uses: ncipollo/release-action@v1
with:
artifacts: "dfhack-*"
2023-07-31 05:43:43 -06:00
bodyFile: "release_body.md"
allowUpdates: true
artifactErrorsFailBuild: true
draft: true
2023-07-31 05:51:44 -06:00
name: "DFHack ${{ steps.gettag.outputs.name }}"
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
replacesArtifacts: true
2023-07-31 05:51:44 -06:00
tag: ${{ steps.gettag.outputs.name }}