Merge pull request #1 from 5stackgg/chore/production #39
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: Build, Push, and Release Plugin | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| workflow_dispatch: | |
| description: 'build' | |
| jobs: | |
| shell-syntax: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: bash -n on every shell script | |
| run: | | |
| set -e | |
| fail=0 | |
| while IFS= read -r -d '' f; do | |
| if ! bash -n "$f"; then | |
| echo "::error file=$f::bash syntax error" | |
| fail=1 | |
| fi | |
| done < <(find src tests -type f -name '*.sh' -print0) | |
| exit $fail | |
| cli-smoke: | |
| needs: shell-syntax | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: tests/cli.sh | |
| run: tests/cli.sh | |
| build-push-and-release: | |
| needs: [shell-syntax, cli-smoke] | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/game-streamer:latest | |
| ghcr.io/${{ github.repository_owner }}/game-streamer:${{ github.sha }} | |
| # Registry-backed cache: a dedicated :buildcache tag on ghcr stores | |
| # the layer cache across runs (no 10GB GHA-cache ceiling, survives | |
| # branch/PR boundaries). First build is a full rebuild; every | |
| # subsequent build reuses unchanged apt/steamcmd/CS2 layers. | |
| cache-from: | | |
| type=registry,ref=ghcr.io/${{ github.repository_owner }}/game-streamer:buildcache | |
| cache-to: | | |
| type=registry,ref=ghcr.io/${{ github.repository_owner }}/game-streamer:buildcache,mode=max |