Skip to content

Commit

Permalink
fix: workflows (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
jolexxa authored Apr 6, 2023
1 parent 4c82caa commit c61b59a
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 96 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/auto_release.yaml
Original file line number Diff line number Diff line change
@@ -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' }}
51 changes: 0 additions & 51 deletions .github/workflows/check-dist.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/release_on_push.yaml

This file was deleted.

70 changes: 68 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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/[email protected]
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/
22 changes: 0 additions & 22 deletions .github/workflows/test_global_json.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/update_major_version.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"words": [
"Chickensoft",
"godotsharp",
"majorver",
"msbuild",
"NOLOGO",
"norelease",
"nowactions",
"OPTOUT",
"rymndhng"
]
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down

0 comments on commit c61b59a

Please sign in to comment.