From 33f91b138bbf73d04ecfdbdfc9c2d81a604ee7a0 Mon Sep 17 00:00:00 2001 From: dutchie031 Date: Fri, 24 Jul 2026 21:33:54 +0200 Subject: [PATCH] testing the new runners --- .github/workflows/publish-github-action.yml | 319 +++++++++++--------- 1 file changed, 172 insertions(+), 147 deletions(-) diff --git a/.github/workflows/publish-github-action.yml b/.github/workflows/publish-github-action.yml index 0e9d1d7..76dbfb2 100644 --- a/.github/workflows/publish-github-action.yml +++ b/.github/workflows/publish-github-action.yml @@ -4,15 +4,16 @@ on: push: branches: - main - paths: - - github-action/package.json + # paths: + # - github-action/package.json permissions: contents: write jobs: - verify_action: - name: Verify action + + test: + name: Test action runs-on: ubuntu-latest steps: - name: Checkout repository @@ -31,170 +32,194 @@ jobs: working-directory: github-action run: npm ci - - name: Create verification fixture - shell: bash - run: | - mkdir -p test-action-input - cat <<'EOF' > test-action-input/main.lua - local message = {} + - name: Run action tests + working-directory: github-action + run: npm test - message.hello = function() - return "hello" - end + # verify_action: + # name: Verify action + # runs-on: linux + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - return message - EOF + # - name: Set up Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: 22 + # cache: npm + # cache-dependency-path: github-action/package-lock.json - - name: Run action locally - uses: ./github-action - with: - source-root: test-action-input - output-file: test-action-output/compiled.lua + # - name: Install action dependencies + # working-directory: github-action + # run: npm ci - - name: Assert compiled output exists - shell: bash - run: test -f test-action-output/compiled.lua + # - name: Create verification fixture + # shell: bash + # run: | + # mkdir -p test-action-input + # cat <<'EOF' > test-action-input/main.lua + # local message = {} - derive_release: - name: Derive release metadata - runs-on: ubuntu-latest - needs: verify_action - outputs: - version: ${{ steps.derive.outputs.version }} - release_tag: ${{ steps.derive.outputs.release_tag }} - rolling_minor_tag: ${{ steps.derive.outputs.rolling_minor_tag }} - rolling_major_tag: ${{ steps.derive.outputs.rolling_major_tag }} - bump_kind: ${{ steps.derive.outputs.bump_kind }} - should_publish: ${{ steps.derive.outputs.should_publish }} - latest_release_tag: ${{ steps.derive.outputs.latest_release_tag }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 + # message.hello = function() + # return "hello" + # end - - name: Derive version and tags - id: derive - shell: bash - run: | - set -euo pipefail + # return message + # EOF - version=$(node -p "require('./github-action/package.json').version") - if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "github-action/package.json version must be semver X.Y.Z, got: $version" >&2 - exit 1 - fi + # - name: Run action locally + # uses: ./github-action + # with: + # source-root: test-action-input + # output-file: test-action-output/compiled.lua - IFS='.' read -r major minor patch <<< "$version" - release_tag="action/v${version}" - rolling_minor_tag="action/v${major}.${minor}" - rolling_major_tag="action/v${major}" + # - name: Assert compiled output exists + # shell: bash + # run: test -f test-action-output/compiled.lua - latest_release_tag=$(git tag --list 'action/v*.*.*' --sort=-version:refname | head -n 1) + # derive_release: + # name: Derive release metadata + # runs-on: linux + # needs: verify_action + # outputs: + # version: ${{ steps.derive.outputs.version }} + # release_tag: ${{ steps.derive.outputs.release_tag }} + # rolling_minor_tag: ${{ steps.derive.outputs.rolling_minor_tag }} + # rolling_major_tag: ${{ steps.derive.outputs.rolling_major_tag }} + # bump_kind: ${{ steps.derive.outputs.bump_kind }} + # should_publish: ${{ steps.derive.outputs.should_publish }} + # latest_release_tag: ${{ steps.derive.outputs.latest_release_tag }} + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - bump_kind="initial" - should_publish="true" + # - name: Derive version and tags + # id: derive + # shell: bash + # run: | + # set -euo pipefail - if [[ -n "$latest_release_tag" ]]; then - latest_version=${latest_release_tag#action/v} + # version=$(node -p "require('./github-action/package.json').version") + # if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + # echo "github-action/package.json version must be semver X.Y.Z, got: $version" >&2 + # exit 1 + # fi - if [[ "$version" == "$latest_version" ]]; then - should_publish="false" - bump_kind="duplicate" - else - IFS='.' read -r latest_major latest_minor latest_patch <<< "$latest_version" + # IFS='.' read -r major minor patch <<< "$version" + # release_tag="action/v${version}" + # rolling_minor_tag="action/v${major}.${minor}" + # rolling_major_tag="action/v${major}" - if (( major < latest_major )) || \ - (( major == latest_major && minor < latest_minor )) || \ - (( major == latest_major && minor == latest_minor && patch < latest_patch )); then - echo "github-action/package.json version $version must be greater than latest published $latest_version" >&2 - exit 1 - fi + # latest_release_tag=$(git tag --list 'action/v*.*.*' --sort=-version:refname | head -n 1) - if (( major > latest_major )); then - bump_kind="major" - elif (( minor > latest_minor )); then - bump_kind="minor" - elif (( patch > latest_patch )); then - bump_kind="patch" - else - echo "Unable to derive release kind from $latest_version -> $version" >&2 - exit 1 - fi - fi - fi + # bump_kind="initial" + # should_publish="true" - echo "version=$version" >> "$GITHUB_OUTPUT" - echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT" - echo "rolling_minor_tag=$rolling_minor_tag" >> "$GITHUB_OUTPUT" - echo "rolling_major_tag=$rolling_major_tag" >> "$GITHUB_OUTPUT" - echo "bump_kind=$bump_kind" >> "$GITHUB_OUTPUT" - echo "should_publish=$should_publish" >> "$GITHUB_OUTPUT" - echo "latest_release_tag=$latest_release_tag" >> "$GITHUB_OUTPUT" + # if [[ -n "$latest_release_tag" ]]; then + # latest_version=${latest_release_tag#action/v} - - name: Summarize release plan - shell: bash - run: | - { - echo "## Action release plan" - echo "" - echo "- Version: ${{ steps.derive.outputs.version }}" - echo "- Release tag: ${{ steps.derive.outputs.release_tag }}" - echo "- Rolling minor tag: ${{ steps.derive.outputs.rolling_minor_tag }}" - echo "- Rolling major tag: ${{ steps.derive.outputs.rolling_major_tag }}" - echo "- Bump kind: ${{ steps.derive.outputs.bump_kind }}" - echo "- Latest published tag: ${{ steps.derive.outputs.latest_release_tag || 'none' }}" - echo "- Will publish: ${{ steps.derive.outputs.should_publish }}" - } >> "$GITHUB_STEP_SUMMARY" + # if [[ "$version" == "$latest_version" ]]; then + # should_publish="false" + # bump_kind="duplicate" + # else + # IFS='.' read -r latest_major latest_minor latest_patch <<< "$latest_version" - publish_tags: - name: Publish tags - runs-on: ubuntu-latest - needs: derive_release - if: ${{ needs.derive_release.outputs.should_publish == 'true' }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 + # if (( major < latest_major )) || \ + # (( major == latest_major && minor < latest_minor )) || \ + # (( major == latest_major && minor == latest_minor && patch < latest_patch )); then + # echo "github-action/package.json version $version must be greater than latest published $latest_version" >&2 + # exit 1 + # fi - - name: Create immutable release tag - shell: bash - run: | - set -euo pipefail - release_tag='${{ needs.derive_release.outputs.release_tag }}' + # if (( major > latest_major )); then + # bump_kind="major" + # elif (( minor > latest_minor )); then + # bump_kind="minor" + # elif (( patch > latest_patch )); then + # bump_kind="patch" + # else + # echo "Unable to derive release kind from $latest_version -> $version" >&2 + # exit 1 + # fi + # fi + # fi - if git rev-parse "$release_tag" >/dev/null 2>&1; then - echo "Release tag $release_tag already exists" >&2 - exit 1 - fi + # echo "version=$version" >> "$GITHUB_OUTPUT" + # echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT" + # echo "rolling_minor_tag=$rolling_minor_tag" >> "$GITHUB_OUTPUT" + # echo "rolling_major_tag=$rolling_major_tag" >> "$GITHUB_OUTPUT" + # echo "bump_kind=$bump_kind" >> "$GITHUB_OUTPUT" + # echo "should_publish=$should_publish" >> "$GITHUB_OUTPUT" + # echo "latest_release_tag=$latest_release_tag" >> "$GITHUB_OUTPUT" - git tag "$release_tag" "$GITHUB_SHA" + # - name: Summarize release plan + # shell: bash + # run: | + # { + # echo "## Action release plan" + # echo "" + # echo "- Version: ${{ steps.derive.outputs.version }}" + # echo "- Release tag: ${{ steps.derive.outputs.release_tag }}" + # echo "- Rolling minor tag: ${{ steps.derive.outputs.rolling_minor_tag }}" + # echo "- Rolling major tag: ${{ steps.derive.outputs.rolling_major_tag }}" + # echo "- Bump kind: ${{ steps.derive.outputs.bump_kind }}" + # echo "- Latest published tag: ${{ steps.derive.outputs.latest_release_tag || 'none' }}" + # echo "- Will publish: ${{ steps.derive.outputs.should_publish }}" + # } >> "$GITHUB_STEP_SUMMARY" - - name: Update rolling tags - shell: bash - run: | - set -euo pipefail - git tag -f '${{ needs.derive_release.outputs.rolling_minor_tag }}' "$GITHUB_SHA" - git tag -f '${{ needs.derive_release.outputs.rolling_major_tag }}' "$GITHUB_SHA" + # publish_tags: + # name: Publish tags + # runs-on: linux + # needs: derive_release + # if: ${{ needs.derive_release.outputs.should_publish == 'true' }} + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: Push release tags - shell: bash - run: | - set -euo pipefail - git push origin '${{ needs.derive_release.outputs.release_tag }}' - git push origin '${{ needs.derive_release.outputs.rolling_minor_tag }}' --force - git push origin '${{ needs.derive_release.outputs.rolling_major_tag }}' --force + # - name: Create immutable release tag + # shell: bash + # run: | + # set -euo pipefail + # release_tag='${{ needs.derive_release.outputs.release_tag }}' - - name: Summarize published tags - shell: bash - run: | - { - echo "## Published action tags" - echo "" - echo "- Immutable: ${{ needs.derive_release.outputs.release_tag }}" - echo "- Rolling minor: ${{ needs.derive_release.outputs.rolling_minor_tag }}" - echo "- Rolling major: ${{ needs.derive_release.outputs.rolling_major_tag }}" - echo "- Bump kind: ${{ needs.derive_release.outputs.bump_kind }}" - } >> "$GITHUB_STEP_SUMMARY" + # if git rev-parse "$release_tag" >/dev/null 2>&1; then + # echo "Release tag $release_tag already exists" >&2 + # exit 1 + # fi + + # git tag "$release_tag" "$GITHUB_SHA" + + # - name: Update rolling tags + # shell: bash + # run: | + # set -euo pipefail + # git tag -f '${{ needs.derive_release.outputs.rolling_minor_tag }}' "$GITHUB_SHA" + # git tag -f '${{ needs.derive_release.outputs.rolling_major_tag }}' "$GITHUB_SHA" + + # - name: Push release tags + # shell: bash + # run: | + # set -euo pipefail + # git push origin '${{ needs.derive_release.outputs.release_tag }}' + # git push origin '${{ needs.derive_release.outputs.rolling_minor_tag }}' --force + # git push origin '${{ needs.derive_release.outputs.rolling_major_tag }}' --force + + # - name: Summarize published tags + # shell: bash + # run: | + # { + # echo "## Published action tags" + # echo "" + # echo "- Immutable: ${{ needs.derive_release.outputs.release_tag }}" + # echo "- Rolling minor: ${{ needs.derive_release.outputs.rolling_minor_tag }}" + # echo "- Rolling major: ${{ needs.derive_release.outputs.rolling_major_tag }}" + # echo "- Bump kind: ${{ needs.derive_release.outputs.bump_kind }}" + # } >> "$GITHUB_STEP_SUMMARY"