workstation #720
This file contains 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: workstation | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- 'v*.*.*' | |
paths-ignore: | |
- README.md | |
- CHANGELOG.md | |
pull_request: | |
branches: | |
- 'main' | |
schedule: | |
- cron: '5 3 * * *' | |
workflow_dispatch: | |
jobs: | |
buildx: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Packages Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Docker Hub registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_KEY }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/lazzurs/workstation | |
lazzurs/workstation | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule,pattern={{date 'YYYYMMDD'}} | |
type=sha | |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} | |
type=raw,value=${{ github.sha }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/[email protected] | |
with: | |
trivy-config: trivy.yaml | |
image-ref: ghcr.io/lazzurs/workstation:${{ github.sha }} | |
output: 'trivy-results.sarif' | |
- name: Upload Trivy scan results to GitHub Security | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: 'trivy-results.sarif' |