Skip to content

Commit

Permalink
build: add development snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Mar 26, 2024
1 parent 5b9d3d9 commit 2d7c918
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 16 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish a pre-release

permissions:
contents: write

on:
push:
branch: develop

jobs:
publish_prerelease:
name: 'Create a prerelease'
uses: ./.github/workflows/release.yml
with:
release_name: 'Development snapshot'
draft: false
prerelease: true
tag_name: latest
74 changes: 58 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,55 @@ on:
push:
branch: stable
tags:
- 'v?[0-9]*'
- "v?[0-9]*"

workflow_call:
inputs:
draft:
description: 'Draft'
description: "Draft"
required: true
default: false
type: boolean
prerelease:
description: 'Prerelease'
description: "Prerelease"
required: true
type: boolean
release_name:
description: "Release name"
required: true
default: "Release ${{ github.ref_name }}"
type: string
tag_name:
description: "Tag name"
required: false
default: "${{ github.ref }}"
type: string

workflow_dispatch:
inputs:
draft:
description: 'Draft'
description: "Draft"
required: true
default: true
type: boolean
prerelease:
description: 'Prerelease'
description: "Prerelease"
required: true
default: false
type: boolean
release_name:
description: "Release name"
required: true
default: "Draft release"
type: string
tag_name:
description: "Tag name"
required: false
default: null
type: string

jobs:
package_asset:
package_multiplatform:
name: Build release assets
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -67,40 +87,62 @@ jobs:
*.zip
*.exe
public_mac:
name: 'Build release assets (mac)'
package_mac:
name: "Build release assets (mac)"
uses: ./.github/workflows/build_macos.yml
secrets: inherit

publish_release:
name: Create a GitHub release
runs-on: ubuntu-latest
needs:
- package_asset
- public_mac
- package_multiplatform
- package_mac

steps:
- name: Install dependencies
- name: "Install dependencies"
uses: taiki-e/install-action@just

- name: Checkout code
- name: "Checkout code"
uses: actions/checkout@v4

- name: Download built game assets
- name: "Download built game assets"
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true

- name: Generate Changelog
- name: "Generate changelog"
run: |
just output-current-changelog > _changes.txt
- name: Release
- name: "Get information on the latest pre-release"
if: ${{ inputs.prerelease }}
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 }}
uses: EndBug/latest-tag@latest

- name: "Delete old pre-release assets"
if: ${{ inputs.prerelease }}
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: Release ${{ github.ref_name }}
name: ${{ inputs.release_name }}
tag_name: ${{ inputs.tag_name }}
body_path: _changes.txt
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
Expand Down
1 change: 1 addition & 0 deletions tools/shared/versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def generate_version() -> str:
"--always",
"--abbrev=7",
"--tags",
"--dirty",
"--exclude",
"latest",
]
Expand Down

0 comments on commit 2d7c918

Please sign in to comment.