This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
docs: release 0.1.1 #6
Workflow file for this run
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: Publish a new release | |
permissions: | |
contents: write | |
on: | |
push: | |
branch: stable | |
tags: | |
- "v?[0-9]*" | |
workflow_call: | |
inputs: | |
draft: | |
type: boolean | |
description: "Draft" | |
required: true | |
default: false | |
prerelease: | |
type: boolean | |
description: "Prerelease" | |
required: true | |
default: false | |
release_name: | |
type: string | |
description: "Release name" | |
required: true | |
default: "Release ${{ github.ref_name }}" | |
tag_name: | |
type: string | |
description: "Tag name" | |
required: false | |
default: github.ref_name | |
workflow_dispatch: | |
inputs: | |
draft: | |
description: "Draft" | |
required: true | |
type: boolean | |
default: false | |
prerelease: | |
description: "Prerelease" | |
required: true | |
type: boolean | |
default: false | |
release_name: | |
description: "Release name" | |
required: true | |
type: string | |
default: "Release name" | |
tag_name: | |
description: "Tag name" | |
required: false | |
type: string | |
default: github.ref_Name | |
jobs: | |
package_multiplatform: | |
name: Build release assets | |
runs-on: ubuntu-latest | |
if: vars.RELEASE_ENABLE == 'true' | |
strategy: | |
matrix: | |
include: | |
- platform: win | |
just_target: package-win | |
steps: | |
- name: Install dependencies | |
uses: taiki-e/install-action@just | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Package asset (${{ matrix.platform }}) | |
run: just ${{ matrix.just_target }} | |
- name: Upload the artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packaged_asset-${{ matrix.platform }} | |
path: | | |
*.zip | |
*.exe | |
publish_release: | |
if: vars.RELEASE_ENABLE == 'true' | |
name: Create a GitHub release | |
runs-on: ubuntu-latest | |
needs: | |
- package_multiplatform | |
steps: | |
- name: "Install dependencies" | |
uses: taiki-e/install-action@just | |
- name: "Checkout code" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Download built game assets" | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
merge-multiple: true | |
- name: "Generate changelog" | |
run: | | |
hash=$(git log -1 --pretty=format:%H) | |
tag=$(just output-current-version) | |
echo -e "**Commit: $hash** \n**Tag: $tag**\n\n### Changes\n" > _changes.txt | |
just output-current-changelog >> _changes.txt | |
- name: "Get information on the latest pre-release" | |
if: ${{ inputs.prerelease == true || inputs.prerelease == 'true' }} | |
id: last_release | |
uses: InsonusK/[email protected] | |
with: | |
myToken: ${{ github.token }} | |
exclude_types: "draft|release" | |
- name: 'Mark the pre-release as latest' | |
if: ${{ inputs.prerelease == true || inputs.prerelease == 'true' }} | |
uses: EndBug/latest-tag@latest | |
- name: "Delete old pre-release assets" | |
if: ${{ inputs.prerelease == true || inputs.prerelease == 'true' }} | |
uses: mknejp/delete-release-assets@v1 | |
continue-on-error: true | |
with: | |
token: ${{ github.token }} | |
tag: ${{ steps.last_release.outputs.tag_name }} | |
assets: "*.*" | |
- name: "Publish a release" | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ inputs.release_name }} | |
tag_name: ${{ inputs.tag_name }} | |
body_path: _changes.txt | |
draft: ${{ inputs.draft == true || inputs.draft == 'true' }} | |
prerelease: ${{ inputs.prerelease == true || inputs.prerelease == 'true' }} | |
fail_on_unmatched_files: true | |
files: | | |
artifacts/* |