fix: workflows (#30)

This commit is contained in:
Joanna May 2023-04-06 18:41:12 -05:00 committed by GitHub
parent 4c82caa6ee
commit c61b59a7c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 122 additions and 96 deletions

36
.github/workflows/auto_release.yaml vendored Normal file
View File

@ -0,0 +1,36 @@
name: 📦 Release On Push
on:
workflow_run:
workflows: ["test"]
branches:
- main
types:
- completed
workflow_dispatch:
inputs:
bump_version_scheme:
description: 'Bump version scheme (major, minor, patch)'
required: true
default: 'minor'
type: choice
options:
- 'major'
- 'minor'
- 'patch'
jobs:
release-on-push:
name: 📦 Release On Push
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
env:
# Use a personal access token with push access to the repo.
# If you don't, pushing a release and tag will not cause subsequent
# workflows to run, like the update_major_version workflow.
GITHUB_TOKEN: ${{ secrets.GH_BASIC }}
steps:
- name: 📦 Release On Push
uses: rymndhng/release-on-push-action@master
with:
# Use bump version given to us or fall back to `minor`.
bump_version_scheme: ${{ github.event.inputs.bump_version_scheme || 'patch' }}

View File

@ -1,51 +0,0 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3.6.0
with:
node-version: 16.x
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: |
npm run build
npm run package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-all-space --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

View File

@ -1,18 +0,0 @@
name: 📦 Release On Push
on:
push:
branches:
- main
# See CONTRIBUTING.md for more information on how this action works.
jobs:
release-on-push:
name: 📦 Release On Push
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: rymndhng/release-on-push-action@master
with:
bump_version_scheme: minor

View File

@ -1,11 +1,23 @@
name: 'build-test'
on: # rebuild any PRs and main branch changes
name: 'test'
on:
pull_request:
paths-ignore:
- '**.md'
tags-ignore:
- '**'
push:
branches:
- '**'
paths-ignore:
- '**.md'
tags-ignore:
- '**'
workflow_dispatch:
jobs:
tests:
name: 🧪 Test on ${{ matrix.os }}, .NET=${{ matrix.use-dotnet }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ${{ matrix.os }}
strategy:
# Don't cancel other OS runners if one fails.
@ -47,3 +59,57 @@ jobs:
- name: 🔬 Verify Godot
run: |
godot --version
test-global-json:
name: 🌐 Test with version from global.json
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: 🧾 Checkout
- uses: ./
name: 🤖 Setup Godot
with:
version: global.json # Use the version specified in global.json
use-dotnet: false
- name: 🔬 Verify Godot
run: |
godot --version
check-dist:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3.6.0
with:
node-version: 16.x
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: |
npm run build
npm run package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-all-space --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

View File

@ -1,22 +0,0 @@
name: 'build-test-global-json'
on: # rebuild any PRs and main branch changes
pull_request:
push:
jobs:
tests:
name: 🌐 Test with version from global.json
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: 🧾 Checkout
- uses: ./
name: 🤖 Setup Godot
with:
version: global.json # Use the version specified in global.json
use-dotnet: false
- name: 🔬 Verify Godot
run: |
godot --version

View File

@ -0,0 +1,13 @@
name: 💥 Update Major Version Tag
on:
push:
tags:
- "v*"
jobs:
update-majorver:
name: 💥 Update Major Version Tag
runs-on: ubuntu-latest
steps:
- uses: nowactions/update-majorver@v1

View File

@ -2,9 +2,11 @@
"words": [
"Chickensoft",
"godotsharp",
"majorver",
"msbuild",
"NOLOGO",
"norelease",
"nowactions",
"OPTOUT",
"rymndhng"
]

2
dist/index.js generated vendored
View File

@ -70,7 +70,7 @@ function run(platform) {
core.info(`📁 Checkout directory: ${checkoutDirectory}`);
// See if Godot version needs to be inferred from a global.json file.
if (version.toLowerCase().includes('global')) {
const globalJsonPath = path_1.default.join(checkoutDirectory, 'global.json');
const globalJsonPath = path_1.default.join(checkoutDirectory, version);
const hasGlobalJsonFile = fs.existsSync(globalJsonPath);
core.info(`📢 Inferring Godot version from global.json file.`);
core.info(`🌐 global.json file path: ${globalJsonPath}`);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@ async function run(platform: Platform): Promise<void> {
// See if Godot version needs to be inferred from a global.json file.
if (version.toLowerCase().includes('global')) {
const globalJsonPath = path.join(checkoutDirectory, 'global.json')
const globalJsonPath = path.join(checkoutDirectory, version)
const hasGlobalJsonFile = fs.existsSync(globalJsonPath)
core.info(`📢 Inferring Godot version from global.json file.`)
core.info(`🌐 global.json file path: ${globalJsonPath}`)