Skip to content

Commit

Permalink
CI: fix flatpak cron and add a way to manually kick off a release (#1…
Browse files Browse the repository at this point in the history
…0567)

* CI: fix mistake stopping flatpak cron from running

* CI: add a way to manually kick off releases with a custom tag

* cmake: handle edge-case where a commit can have multiple tags

* CI: set release channel appropriately when it's a stable release
  • Loading branch information
xTVaser authored Jan 11, 2024
1 parent 3d64f4a commit da28e2c
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/cron_publish_flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
uses: ./.github/workflows/linux_build_flatpak.yml
with:
jobName: "Qt"
artifactPrefixName: "PCSX2-linux-Qt-x64-flatpak"
compiler: clang
cmakeflags: ""
publish: true
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/linux_build_flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ on:
required: false
type: boolean
default: false
stableBuild:
required: false
type: boolean
default: false

jobs:
build_linux:
Expand All @@ -59,6 +63,13 @@ jobs:
if: ${{ inputs.fetchTags }}
run: git fetch --tags --no-recurse-submodules

- name: Add stable release identifier file
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
shell: bash
run: |
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
cat ./pcsx2-qt/DefaultUpdaterChannel.h
- name: Prepare Artifact Metadata
id: artifact-metadata
shell: bash
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/linux_build_qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ on:
required: false
type: boolean
default: false
stableBuild:
required: false
type: boolean
default: false

jobs:
build_linux:
Expand Down Expand Up @@ -72,6 +76,13 @@ jobs:
if: ${{ inputs.fetchTags }}
run: git fetch --tags --no-recurse-submodules

- name: Add stable release identifier file
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
shell: bash
run: |
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
cat ./pcsx2-qt/DefaultUpdaterChannel.h
- name: Prepare Artifact Metadata
id: artifact-metadata
shell: bash
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/macos_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on:
required: false
type: boolean
default: false
stableBuild:
required: false
type: boolean
default: false

jobs:
build_macos:
Expand All @@ -47,6 +51,13 @@ jobs:
if: ${{ inputs.fetchTags }}
run: git fetch --tags --no-recurse-submodules

- name: Add stable release identifier file
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
shell: bash
run: |
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
cat ./pcsx2-qt/DefaultUpdaterChannel.h
- name: Use Xcode 14.3.1
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app

Expand Down
45 changes: 30 additions & 15 deletions .github/workflows/release_cut_new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ on:
push:
branches:
- master
# TODO - future work
# workflow_dispatch:
# inputs:
# isStable:
# description: 'Should it be a stable release?'
# required: true
# default: 'false'
# versionTag:
# description: 'The version to tag with'
# required: true
workflow_dispatch:
inputs:
is_prelease:
description: 'Should be a pre-release?'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
tag_value:
description: 'Create a new release from latest master with the given tag, if this is left blank it will bump the patch version. You dont need to include the "v" prefix'
required: false

permissions:
contents: write
Expand All @@ -42,6 +45,8 @@ jobs:
github_token: ${{ github.token }}
tag_prefix: v
default_bump: patch
# if set, it will overwrite the bump settings
custom_tag: ${{ github.event.inputs.tag_value == '' && null || github.event.inputs.tag_value }}

# TODO - we could do this and remove the node.js script, but auto-generated notes only work
# with PRs -- not commits (determine how much we care).
Expand All @@ -62,9 +67,18 @@ jobs:
node index.js
mv ./release-notes.md ${GITHUB_WORKSPACE}/release-notes.md
- name: Create a GitHub Release
- name: Create a GitHub Release (Manual)
uses: softprops/action-gh-release@v1
if: steps.tag_version.outputs.new_tag
if: steps.tag_version.outputs.new_tag && github.event_name == 'workflow_dispatch'
with:
body_path: ./release-notes.md
draft: true
prerelease: ${{ github.event_name != 'workflow_dispatch' || inputs.is_prelease == 'true' }}
tag_name: ${{ steps.tag_version.outputs.new_tag }}

- name: Create a GitHub Release (Push)
uses: softprops/action-gh-release@v1
if: steps.tag_version.outputs.new_tag && github.event_name != 'workflow_dispatch'
with:
body_path: ./release-notes.md
draft: true
Expand All @@ -86,6 +100,7 @@ jobs:
cmakeflags: ""
buildAppImage: true
fetchTags: true
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
secrets: inherit

build_linux_flatpak:
Expand All @@ -102,6 +117,7 @@ jobs:
branch: "stable"
publish: false
fetchTags: true
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
secrets: inherit

# Windows
Expand All @@ -118,6 +134,7 @@ jobs:
buildSystem: cmake
cmakeFlags: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl
fetchTags: true
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
secrets: inherit

# MacOS
Expand All @@ -131,6 +148,7 @@ jobs:
jobName: "MacOS Build"
artifactPrefixName: "PCSX2-macos-Qt"
fetchTags: true
stableBuild: ${{ github.event_name == 'workflow_dispatch' && inputs.is_prelease == 'false' }}
secrets: inherit

# Upload the Artifacts
Expand Down Expand Up @@ -163,9 +181,6 @@ jobs:
working-directory: ./ci-artifacts/
run: for d in *windows*/; do 7z a "${d}asset.7z" ./$d/*; done

# Artifact Naming:
# MacOS: PCSX2-<tag>-macOS-[additional hyphen seperated tags]
# Windows|Linux: PCSX2-<tag>-<windows|linux>-<32bit|64bit>--[additional hyphen seperated tags]
- name: Name and Upload the Release Assets
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/windows_build_qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ on:
required: false
type: boolean
default: false
stableBuild:
required: false
type: boolean
default: false

jobs:
build_windows_qt:
Expand All @@ -61,6 +65,13 @@ jobs:
if: ${{ inputs.fetchTags }}
run: git fetch --tags --no-recurse-submodules

- name: Add stable release identifier file
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
shell: bash
run: |
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
cat ./pcsx2-qt/DefaultUpdaterChannel.h
- name: Prepare Artifact Metadata
id: artifact-metadata
shell: bash
Expand Down
19 changes: 16 additions & 3 deletions cmake/Pcsx2Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,24 @@ function(get_git_version_info)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)

EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} tag --points-at HEAD
OUTPUT_VARIABLE PCSX2_GIT_TAG
EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} tag --points-at HEAD --sort=version:refname
OUTPUT_VARIABLE PCSX2_GIT_TAG_LIST
RESULT_VARIABLE TAG_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)

# CAUTION: There is a race here, this solves the problem of a commit being tagged multiple times (take the last tag)
# however, if simultaneous builds are pushing tags to the same commit you might get inconsistent results (it's a race)
#
# The easy solution is, don't do that, but just something to be aware of.
if(PCSX2_GIT_TAG_LIST AND TAG_RESULT EQUAL 0)
string(REPLACE "\n" ";" PCSX2_GIT_TAG_LIST "${PCSX2_GIT_TAG_LIST}")
if (PCSX2_GIT_TAG_LIST)
list(GET PCSX2_GIT_TAG_LIST -1 PCSX2_GIT_TAG)
message("Using tag: ${PCSX2_GIT_TAG}")
endif()
endif()

EXECUTE_PROCESS(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
OUTPUT_VARIABLE PCSX2_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down Expand Up @@ -111,7 +124,7 @@ function(write_svnrev_h)
)
endif()
else()
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h
"#define SVN_REV ${PCSX2_WC_TIME}ll\n"
"#define GIT_TAG \"${PCSX2_GIT_TAG}\"\n"
"#define GIT_TAGGED_COMMIT 0\n"
Expand Down

0 comments on commit da28e2c

Please sign in to comment.