From 793a8939c4f721844c276a3d49293c23c902c8d3 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Sun, 26 Mar 2023 09:22:03 -0400 Subject: Add automated git release info retrieval on export Makes debug easier to see and handle Add commit hash label to MainMenu Add click-copyable tag, commit hash, and checksum to main menu Rename VersionChecksumBox to ReleaseInfoBox Move ReleaseInfoBox to separate scene and script Add GIT_INFO.gd for generic project running Add openvic2-plugin addon for handling export plugin Replaces GIT_INFO.gd on export Setup build workflow to retrieve commit hash, tag, and release --- .github/actions/openvic2-env/action.yml | 27 +++++++++++++++++++++++++++ .github/workflows/builds.yml | 12 +++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .github/actions/openvic2-env/action.yml (limited to '.github') diff --git a/.github/actions/openvic2-env/action.yml b/.github/actions/openvic2-env/action.yml new file mode 100644 index 0000000..245777d --- /dev/null +++ b/.github/actions/openvic2-env/action.yml @@ -0,0 +1,27 @@ +name: Setup OpenVic2 Environment +description: Setup OpenVic2 Environment +runs: + using: "composite" + steps: + - name: Setup Environment + uses: actions/github-script@v6 + with: + script: | + const commit_name = 'OPENVIC2_COMMIT'; + const tag_name = 'OPENVIC2_TAG'; + const release_name = 'OPENVIC2_RELEASE'; + var commit_sha = process.env["GITHUB_SHA"]; + if(context.eventName === 'pull_request') { + commit_sha = context.payload.pull_request.head.sha; + } + core.exportVariable(commit_name, commit_sha); + try { + const release = await github.rest.repos.getLatestRelease({owner: context.repo.owner, repo: context.repo.repo}); + core.exportVariable(tag_name, release.data["tag_name"]); + core.exportVariable(release_name, release.data["name"]); + } catch(error) { + if (error.response.status != 404) throw error; + const tagList = await github.rest.repos.listTags({owner: context.repo.owner, repo: context.repo.repo}); + core.exportVariable(tag_name, tagList.data[0].name); + core.exportVariable(release_name, tagList.data[0].name); + } \ No newline at end of file diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 69f4671..be33095 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -56,10 +56,13 @@ jobs: steps: - name: Checkout project - uses: actions/checkout@v3 + uses: actions/checkout@v3.3.0 with: submodules: recursive + - name: Setup Environment + uses: ./.github/actions/openvic2-env + - name: Set up Python uses: actions/setup-python@v4 with: @@ -123,9 +126,13 @@ jobs: name: Peform Godot Debug Checks steps: + - name: Checkout project uses: actions/checkout@v3.3.0 + - name: Setup Environment + uses: ./.github/actions/openvic2-env + - name: Download artifact uses: actions/download-artifact@v3 with: @@ -164,6 +171,9 @@ jobs: - name: Checkout project uses: actions/checkout@v3.3.0 + - name: Setup Environment + uses: ./.github/actions/openvic2-env + - name: Download artifact uses: actions/download-artifact@v3 with: -- cgit v1.2.3-56-ga3b1