fix e2e #12
Workflow file for this run
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: Docker | |
| on: | |
| push: | |
| tags: [ "v*.*.*" ] | |
| release: | |
| types: [ published ] | |
| concurrency: | |
| group: docker-release-${{ github.event.release.tag_name || github.ref_name }} | |
| cancel-in-progress: false | |
| env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name || github.ref_name }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| docker-smoke: | |
| name: Build, smoke test, and publish | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ env.RELEASE_TAG }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build local smoke image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| load: true | |
| tags: sprite-sheet-helper:smoke | |
| - name: Smoke test container help | |
| run: docker run --rm sprite-sheet-helper:smoke --help | |
| - name: Smoke test container spritesheet export | |
| run: | | |
| rm -rf .docker-smoke | |
| mkdir -p .docker-smoke | |
| docker run --rm \ | |
| -v "$PWD:/work" \ | |
| sprite-sheet-helper:smoke \ | |
| /work/example.fbx \ | |
| --format spritesheet \ | |
| --frames 1 \ | |
| --width 32 \ | |
| --height 32 \ | |
| --output /work/.docker-smoke/spritesheet | |
| test -f .docker-smoke/spritesheet/spritesheet.png | |
| test -f .docker-smoke/spritesheet/spritesheet.json | |
| - name: Smoke test container batch config | |
| run: | | |
| cat > .docker-smoke/sprites.config.json <<'JSON' | |
| { | |
| "defaults": { | |
| "format": "spritesheet", | |
| "frames": 1, | |
| "width": 32, | |
| "height": 32 | |
| }, | |
| "jobs": [ | |
| { | |
| "id": "example", | |
| "input": "../example.fbx", | |
| "output": "batch", | |
| "normalMap": true | |
| } | |
| ] | |
| } | |
| JSON | |
| docker run --rm \ | |
| -v "$PWD:/work" \ | |
| sprite-sheet-helper:smoke \ | |
| --config /work/.docker-smoke/sprites.config.json \ | |
| --writeSummary /work/.docker-smoke/summary.json | |
| test -f .docker-smoke/batch/spritesheet.png | |
| test -f .docker-smoke/batch/spritesheet_normal.png | |
| test -f .docker-smoke/summary.json | |
| - name: Log in to GHCR | |
| if: startsWith(env.RELEASE_TAG, 'v') | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker metadata | |
| if: startsWith(env.RELEASE_TAG, 'v') | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ghcr.io/kyonru/sprite-sheet-helper | |
| tags: | | |
| type=semver,pattern=v{{version}} | |
| type=semver,pattern=v{{major}}.{{minor}} | |
| type=semver,pattern=v{{major}} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest | |
| - name: Publish image | |
| if: startsWith(env.RELEASE_TAG, 'v') | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - name: Smoke test published Docker action | |
| if: startsWith(env.RELEASE_TAG, 'v') | |
| uses: ./action | |
| with: | |
| input: example.fbx | |
| output: .docker-action-smoke | |
| format: spritesheet | |
| frames: "1" | |
| width: "32" | |
| height: "32" | |
| - name: Verify Docker action output | |
| if: startsWith(env.RELEASE_TAG, 'v') | |
| run: | | |
| test -f .docker-action-smoke/spritesheet.png | |
| test -f .docker-action-smoke/spritesheet.json | |
| - name: Build example project config | |
| if: startsWith(env.RELEASE_TAG, 'v') | |
| working-directory: example | |
| run: node scripts/build-sprite-config.mjs | |
| - name: Smoke test example project with published Docker action | |
| if: startsWith(env.RELEASE_TAG, 'v') | |
| id: example_sprites | |
| uses: ./action | |
| with: | |
| config: example/sprite-sheet-helper.generated.json | |
| fail-on-warnings: "false" | |
| - name: Save example action summary | |
| if: startsWith(env.RELEASE_TAG, 'v') && always() | |
| env: | |
| SUMMARY_JSON: ${{ steps.example_sprites.outputs['summary-json'] }} | |
| run: | | |
| mkdir -p example/dist | |
| node -e 'const fs = require("fs"); fs.writeFileSync("example/dist/sprite-sheet-helper-summary.json", `${process.env.SUMMARY_JSON || "{}"}\n`);' | |
| - name: Verify example project output | |
| if: startsWith(env.RELEASE_TAG, 'v') | |
| run: | | |
| test -f example/sprite-sheet-helper.generated.json | |
| test -f example/dist/sprites/example/spritesheet.png | |
| test -f example/dist/sprites/example/spritesheet_normal.png | |
| test -f example/dist/sprites/example/spritesheet.json | |
| test -f example/dist/sprite-sheet-helper-summary.json | |
| find example/dist -maxdepth 5 -type f | sort | |
| - name: Upload example project output | |
| if: startsWith(env.RELEASE_TAG, 'v') && always() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: example-project-output | |
| path: | | |
| example/dist/ | |
| example/sprite-sheet-helper.generated.json | |
| retention-days: 14 | |
| - name: Upload container smoke outputs | |
| if: always() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: docker-smoke-output | |
| path: | | |
| .docker-smoke/ | |
| .docker-action-smoke/ | |
| example/dist/ | |
| example/sprite-sheet-helper.generated.json | |
| retention-days: 3 |