adaptive-lighting/.github/workflows
lenucksi 9c7a95f696
fix(ci): fix broken Docker workflow and modernize (#1318)
* fix(ci): fix broken Docker workflow and modernize

## Critical Bug Fixes

1. **Fix broken push condition** (CRITICAL):
   - Old: `push: ${{ github.ref == 'refs/heads/master' }}`
   - Problem: Branch renamed to `main`, so images NEVER pushed
   - New: `push: ${{ github.event_name != 'pull_request' }}`
   - Result: Docker images will actually be published again

2. **Add missing checkout step**:
   - Build was failing because source code wasn't checked out
   - Required for Docker build context

## Modernization Improvements

3. **Migrate to GitHub Container Registry (GHCR)**:
   - Old: DockerHub with `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN` secrets
   - New: GHCR with built-in `GITHUB_TOKEN`
   - Benefits: No external account required, better integration

4. **Add semantic versioning**:
   - Automatically tags releases: `v1.2.3`, `v1.2`, `v1`, `latest`
   - Supports version tags (v*), branches, and PRs
   - Uses docker/metadata-action for automatic tagging

5. **Add GitHub Actions caching**:
   - Uses `type=gha` cache for faster builds
   - Reduces build times and GitHub Actions minutes

6. **Security: Digest pinning**:
   - All actions pinned to commit SHAs
   - Prevents supply chain attacks via tag manipulation
   - Follows security best practices

7. **Add explicit permissions**:
   - Minimal required permissions (contents: read, packages: write)
   - Follows principle of least privilege

8. **Add workflow triggers**:
   - Tags (v*) for releases
   - Pull requests for testing
   - Manual dispatch for on-demand builds

## Testing

- Workflow syntax validated
- Push logic tested with different event types
- Compatible with existing Docker build process

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor(ci): simplify docker workflow

- Use version tags instead of SHA pins for readability
- Remove verbose step names (action names are self-documenting)
- Compact YAML formatting
- Fix actions/checkout to v4 (v6 doesn't exist)

---------

Co-authored-by: Bas Nijholt <bas@nijho.lt>
2025-12-12 13:49:45 -08:00
..
install_dependencies ⬆️ Update actions/setup-python action to v6 (#1261) 2025-11-27 09:34:46 -08:00
deploy-webapp.yml ⬆️ Update python to v3.14.2 (#1251) 2025-12-09 23:31:41 -08:00
docker-build.yml fix(ci): fix broken Docker workflow and modernize (#1318) 2025-12-12 13:49:45 -08:00
hassfest.yaml ⬆️ Update actions/checkout action to v6.0.1 (#1328) 2025-12-09 23:31:17 -08:00
main-to-master-sync.yml ⬆️ Update actions/checkout action to v6 (#1288) 2025-11-27 09:27:27 -08:00
pre-commit.yaml ⬆️ Update actions/setup-python action to v6 (#1261) 2025-11-27 09:34:46 -08:00
pytest.yaml ⬆️ Update actions/checkout action to v6 (#1288) 2025-11-27 09:27:27 -08:00
release-drafter.yml ⬆️ Update release-drafter/release-drafter action to v6 (#1119) 2024-12-05 21:41:23 +02:00
toc.yaml fix(ci): add branch filter to TOC generator workflow (#1320) 2025-11-30 08:06:21 -08:00
update-readme.yml fix(ci): correct branch name and path in update-readme workflow (#1321) 2025-11-30 08:22:57 -08:00
update-test-matrix.yaml ⬆️ Update python to v3.14.2 (#1251) 2025-12-09 23:31:41 -08:00
validate.yml ⬆️ Update actions/checkout action to v6 (#1288) 2025-11-27 09:27:27 -08:00