generated from vrchat-community/template-package
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9eb4fa9
commit e8b6453
Showing
5 changed files
with
85 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ name: Build Release | |
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
@@ -12,33 +11,87 @@ on: | |
env: | ||
packageName: "nadena.dev.ndmf" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
run-tests: | ||
needs: prechecks | ||
if: needs.prechecks.outputs.need-new-tag == 'true' | ||
uses: bdunderscore/ndmf/.github/workflows/gameci.yml@main | ||
prechecks: | ||
runs-on: ubuntu-latest | ||
needs: run-tests | ||
outputs: | ||
version: ${{ steps.version.outputs.prop }} | ||
need-new-tag: ${{ steps.check-tag.outputs.need-new-tag }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: get version | ||
id: version | ||
uses: notiz-dev/github-action-json-property@a5a9c668b16513c737c3e1f8956772c99c73f6e8 | ||
with: | ||
path: "package.json" | ||
prop_path: "version" | ||
|
||
- name: Check if version is tagged | ||
id: check-tag | ||
run: | | ||
if git fetch origin $current_version --depth=1; then | ||
echo "Version $current_version is already tagged" | ||
echo "need-new-tag=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "Version $current_version is not tagged" | ||
echo "need-new-tag=true" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Verify that this is the first revision with this version | ||
if: steps.check_tagged.outputs.need_tag == 'true' | ||
run: | | ||
git fetch --unshallow | ||
git checkout HEAD~ package.json | ||
if [ "$(jq -r .version package.json)" == "$current_version" ]; then | ||
echo "Error: Looks like we skipped the version bump commit." | ||
exit 1 | ||
fi | ||
- name: Check semver syntax | ||
if: steps.check_tagged.outputs.need_tag == 'true' | ||
id: semver-check | ||
run: | | ||
chmod +x .github/scripts/*.sh | ||
.github/scripts/check-semver.sh ${{ steps.version.outputs.prop }} | ||
- name: Check tag consistency | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
REF_NAME: ${{ github.ref }} | ||
run: | | ||
if echo $REF_NAME | grep '[a-z]-[0-9]' && ! echo $REF_NAME | grep '^refs/tags/1\.5\.0-'; then | ||
echo "Tag name does not follow semver prerelease syntax: $REF_NAME" | ||
if [ "${{ steps.version.outputs.prop }}" != "${GITHUB_REF##*/}" ]; then | ||
echo "Version in package.json does not match tag name: ${{ steps.version.outputs.prop }} != ${GITHUB_REF##*/}" | ||
exit 1 | ||
fi | ||
- name: get version | ||
create-release: | ||
needs: [prechecks, run-tests] | ||
runs-on: ubuntu-latest | ||
if: needs.prechecks.outputs.need-new-tag == 'true' || startsWith(github.ref, 'refs/tags/') | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Reexport version | ||
id: version | ||
uses: notiz-dev/github-action-json-property@a5a9c668b16513c737c3e1f8956772c99c73f6e8 | ||
with: | ||
path: "package.json" | ||
prop_path: "version" | ||
run: | | ||
echo "version=${{ needs.prechecks.outputs.version }}" >> $GITHUB_ENV | ||
# Re-check semver syntax in case this is being triggered by a manual tag push | ||
- name: Check semver syntax | ||
if: steps.check_tagged.outputs.need_tag == 'true' | ||
id: semver-check | ||
run: | | ||
chmod +x .github/scripts/*.sh | ||
.github/scripts/check-semver.sh ${{ steps.version.outputs.prop }} | ||
- name: Check tag consistency | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
@@ -48,8 +101,6 @@ jobs: | |
exit 1 | ||
fi | ||
- run: echo ${{steps.version.outputs.prop}} | ||
|
||
- name: Set Environment Variables | ||
run: | | ||
echo "zipFile=${{ env.packageName }}-${{ steps.version.outputs.prop }}".zip >> $GITHUB_ENV | ||
|
@@ -71,6 +122,14 @@ jobs: | |
with: | ||
name: package-zip | ||
path: ${{ env.zipFile }} | ||
|
||
- name: Create tag | ||
if: needs.prechecks.outputs.need-new-tag == 'true' | ||
run: | | ||
git config user.name "Github Actions" | ||
git config user.email "[email protected]" | ||
git tag ${{ steps.version.outputs.prop }} | ||
git push origin ${{ steps.version.outputs.prop }} | ||
- name: Make Release | ||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
set -x | ||
|
||
if echo $1 | grep '[a-z]-[0-9]' > /dev/null; then | ||
echo "Tag name does not follow semver prerelease syntax: $REF_NAME" | ||
exit 1 | ||
fi |
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
This file was deleted.
Oops, something went wrong.
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