Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork630
fear(api-v3): updateVehicleMissionType enum (#1635)#253
This file contains hidden or 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:🌕🏭 Create Nightly Release | |
| on: | |
| push: | |
| branches: | |
| -main | |
| workflow_dispatch: | |
| inputs: | |
| semver_name: | |
| description:'Custom semver name without pre-release identifiers' | |
| required:false | |
| type:string | |
| prerelease_build_number: | |
| description:'Custom pre-release build number' | |
| required:false | |
| type:string | |
| default:'0' | |
| permissions: | |
| contents:read | |
| # needs to ensure that only a single workflow will run at a time in order to prevent from the next tag being occupied | |
| # by another workflow | |
| concurrency: | |
| group:${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress:true | |
| jobs: | |
| calc-next-tag-name: | |
| name:Get Latest commit hash on Nightly Repo and Calculate New Version Tag | |
| runs-on:ubuntu-latest | |
| outputs: | |
| sha_on_main_branch_in_nightly_repo:${{ steps.calc-next-tag-name.outputs.sha_nightly_repo }} | |
| next_version_name_for_tags:${{ steps.calc-next-tag-name.outputs.next_version_name_for_tags }} | |
| next_version_name_for_assemblies:${{ steps.calc-next-tag-name.outputs.next_version_name_for_assemblies }} | |
| steps: | |
| -name:Checkout Nightly Release Repo | |
| uses:actions/checkout@v4 | |
| with: | |
| repository:${{ format('{0}/scripthookvdotnet-nightly', github.repository_owner) }} | |
| path:nightly-repo | |
| fetch-depth:0 | |
| -name:Calculate New Tag | |
| id:calc-next-tag-name | |
| working-directory:nightly-repo | |
| env: | |
| CUSTOM_VERSION_NAME:${{ github.event_name == 'workflow_dispatch' && github.event.inputs.semver_name || '' }} | |
| PRERELEASE_BUILD_NO:${{ github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease_build_number || '0' }} | |
| run:| | |
| echo "sha_nightly_repo=$(git log -n 1 --pretty=format:"%H")" >> "$GITHUB_OUTPUT" | |
| if [ "$CUSTOM_VERSION_NAME" != "" ]; then | |
| # remove the prefix v if exists | |
| CUSTOM_VERSION_NAME=$(echo "${CUSTOM_VERSION_NAME}" | sed -E 's/v?([0-9]{1,5})\.([0-9]{1,5}).([0-9]{1,5})/\1.\2.\3/') | |
| next_version_name_for_tags="${CUSTOM_VERSION_NAME}-nightly.${PRERELEASE_BUILD_NO}" | |
| echo "next_version_name_for_tags=${next_version_name_for_tags}" >> "$GITHUB_OUTPUT" | |
| elif latest_tag_name=$(git describe --tags `git rev-list --tags --max-count=1`); then | |
| # semver command removes the prefix such as "v" | |
| next_version_name_for_tags=$(npx semver "$latest_tag_name" -i prerelease) | |
| echo "next_version_name_for_tags=${next_version_name_for_tags}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "There's no tags on the nightly repo. Please specify a custom version tag." | |
| exit 1 | |
| fi | |
| # e.g. sed will transform "3.6.0-nightly.69" into "3.6.0.69" | |
| next_version_name_for_assemblies=$(echo ${next_version_name_for_tags} | sed -E 's/([0-9]{1,5})\.([0-9]{1,5})\.([0-9]{1,5})-nightly\.([0-9]{1,5})/\1.\2.\3.\4/') | |
| if [ "$next_version_name_for_assemblies" == "$next_version_name_for_tags" ]; then | |
| >&2 echo "Failed to create the version string for the ASI and the scripting DLLs because the version tag is ill-formed as a nightly version tag. Tag name: ${next_version_name_for_tags}" | |
| exit 1 | |
| fi | |
| echo "next_version_name_for_assemblies=${next_version_name_for_assemblies}" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| create-release-note-body-text: | |
| name:Create Body Text for Release | |
| runs-on:ubuntu-latest | |
| outputs: | |
| body_text:${{ steps.body-text.outputs.result }} | |
| steps: | |
| -uses:actions/github-script@v7 | |
| id:body-text | |
| with: | |
| script:| | |
| const commitSha = '${{ github.sha }}'; | |
| console.log(`Searching for Commit - ${commitSha}`); | |
| const { data: commit } = await github.rest.repos.getCommit({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: commitSha, | |
| }); | |
| const commitTitle = commit.commit.message.split('\r\n')[0].split('\n')[0]; | |
| return `- [${commitTitle}](${commit.html_url})\n - Short commit hash: \`${commitSha.substring(0, 7)}\`\n - Full commit hash: \`${commitSha}\``; | |
| result-encoding:string | |
| build: | |
| name:Build Solution | |
| needs:[calc-next-tag-name] | |
| uses:./.github/workflows/build.yml | |
| with: | |
| build-version:${{needs.calc-next-tag-name.outputs.next_version_name_for_assemblies}} | |
| create-new-tag: | |
| name:Push New Version Tag | |
| # wait for the build job so the new tag won't be pushed if the build job fails | |
| needs:[calc-next-tag-name, build] | |
| runs-on:ubuntu-latest | |
| outputs: | |
| tag_name:${{ steps.tag-output.outputs.result }} | |
| steps: | |
| -name:Generate Access Token | |
| uses:actions/create-github-app-token@v1 | |
| id:app-token | |
| with: | |
| app-id:${{ vars.SHVDN_APP_ID }} | |
| private-key:${{ secrets.SHVDN_APP_PRIVATE_KEY }} | |
| owner:'scripthookvdotnet' | |
| repositories:'scripthookvdotnet-nightly' | |
| -name:Push New Tag | |
| uses:actions/github-script@v7 | |
| id:tag-output | |
| env: | |
| SHA_NIGHTLY_REPO:${{ needs.calc-next-tag-name.outputs.sha_on_main_branch_in_nightly_repo }} | |
| TAG_NAME:${{ needs.calc-next-tag-name.outputs.next_version_name_for_tags }} | |
| with: | |
| github-token:${{ steps.app-token.outputs.token }} | |
| script:| | |
| const owner = process.env.GITHUB_REPOSITORY_OWNER; | |
| const repo = 'scripthookvdotnet-nightly'; | |
| const tag = `v${ process.env.TAG_NAME }`; | |
| const message = `${ process.env.GITHUB_REF_NAME }_${tag}`; | |
| const annotatedTag = await github.rest.git.createTag({ | |
| owner, | |
| repo, | |
| tag, | |
| message, | |
| object: process.env.SHA_NIGHTLY_REPO, | |
| type: 'commit', | |
| }); | |
| if (annotatedTag.status !== 201) { | |
| console.log(`Could not create tag. Received ${annotatedTag.status} from API`); | |
| process.exit(1); | |
| } | |
| await github.rest.git.createRef({ | |
| owner, | |
| repo, | |
| ref: `refs/tags/${tag}`, | |
| sha: annotatedTag.data.sha, | |
| }); | |
| return tag; | |
| result-encoding:string | |
| create-release: | |
| name:Publish Release | |
| needs:[create-new-tag, create-release-note-body-text, build] | |
| runs-on:ubuntu-latest | |
| permissions: | |
| contents:write | |
| steps: | |
| -uses:actions/checkout@v4 | |
| -name:Download Artifact from Build Workflow | |
| uses:actions/download-artifact@v4.1.7 | |
| with: | |
| name:ScriptHookVDotNet | |
| path:bin/Release | |
| -run:ls -g | |
| working-directory:bin/Release | |
| -name:Pack build | |
| env: | |
| TAG_NAME:${{ needs.create-new-tag.outputs.tag_name }} | |
| run:| | |
| artifact_name="ScriptHookVDotNet-${TAG_NAME}" | |
| artifact_file_name="${artifact_name}.zip" | |
| echo "artifact_name=${artifact_name}" >> $GITHUB_ENV | |
| echo "artifact_filename=${artifact_file_name}" >> $GITHUB_ENV | |
| cd "${GITHUB_WORKSPACE}/bin/Release" | |
| zip -r "${GITHUB_WORKSPACE}/${artifact_file_name}" * | |
| -name:Generate Access Token | |
| uses:actions/create-github-app-token@v1 | |
| id:app-token | |
| with: | |
| app-id:${{ vars.SHVDN_APP_ID }} | |
| private-key:${{ secrets.SHVDN_APP_PRIVATE_KEY }} | |
| owner:'scripthookvdotnet' | |
| repositories:'scripthookvdotnet-nightly' | |
| -name:Push New Release | |
| uses:ncipollo/release-action@v1.20.0 | |
| with: | |
| repo:scripthookvdotnet-nightly | |
| name:${{ env.artifact_name }} | |
| tag:${{ needs.create-new-tag.outputs.tag_name }} | |
| token:${{ steps.app-token.outputs.token }} | |
| body:${{ needs.create-release-note-body-text.outputs.body_text }} | |
| artifacts:| | |
| ${{ env.artifact_filename }} | |
| artifactErrorsFailBuild:true | |
| omitBodyDuringUpdate:true | |
| omitNameDuringUpdate:true | |
| makeLatest:true | |
| immutableCreate:true |