88 lines
2.6 KiB
YAML
88 lines
2.6 KiB
YAML
name: os
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 5 8,18,28 * *'
|
|
push:
|
|
paths:
|
|
- 'Dockerfile'
|
|
- 'etc/**'
|
|
- 'usr/**'
|
|
- 'repo/**'
|
|
- '.github/workflows/os.yml'
|
|
workflow_dispatch: # Gør det muligt at starte den manuelt til test
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Maximize build space
|
|
uses: AdityaGarg8/remove-unwanted-software@v1
|
|
with:
|
|
remove-dotnet: 'true'
|
|
remove-android: 'true'
|
|
remove-haskell: 'true'
|
|
|
|
- name: Get current date
|
|
id: date
|
|
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4 # Opdateret til v4
|
|
|
|
- name: Install cosign
|
|
if: github.event_name != 'pull_request'
|
|
uses: sigstore/cosign-installer@v3.3.0 # Opdateret version
|
|
with:
|
|
cosign-release: 'v2.2.2'
|
|
|
|
- name: Setup Docker buildx
|
|
uses: docker/setup-buildx-action@v3 # Opdateret til v3
|
|
with:
|
|
# Vigtigt: Aktiverer experimental support i BuildKit
|
|
buildkitd-flags: --allow-insecure-entitlement security.insecure
|
|
|
|
- name: Log into registry ${{ env.REGISTRY }}
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3 # Opdateret til v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
# Her tvinger vi tags til at være lowercase og definerer dine versioner
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=raw,value=10
|
|
type=raw,value=10.${{ steps.date.outputs.date }}
|
|
|
|
- name: Build and push Docker image
|
|
id: build-and-push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
# Nu bruger vi udelukkende tags fra meta-trinnet, som er lowercase-sikre
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
squash: true
|
|
|
|
- name: Sign the published Docker image
|
|
if: ${{ github.event_name != 'pull_request' }}
|
|
env:
|
|
TAGS: ${{ steps.meta.outputs.tags }}
|
|
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
|
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
|