mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-23 14:17:06 +00:00
* ci: take release-please from its current home google-github-actions/release-please-action is archived: the action moved to googleapis/release-please-action, same code, same inputs, same major version, and that is where the fixes now land. The release-please workflow references the maintained repository. * ci: declare what the three unscoped workflows may do with the token Docs Build, Maintain Release Merge PR and Notify HeyPuter had no permissions block, so they ran with the repository's default token scope. Docs Build only checks out and builds, Notify HeyPuter only calls the dispatch endpoint with its own token: both declare contents: read. Maintain Release Merge PR pushes the auto-update/release branch and opens the release pull request, so it declares contents: write and pull-requests: write. The other workflows already declared their scopes and are left as they are. * ci: stop persisting the checkout credentials in the jobs that never push actions/checkout keeps the job token in the clone's git config, where every later step can read it. Twelve checkouts now set persist-credentials: false: the backend and puter.js test jobs, the coverage jobs, the type checks, the docs build, the AI provider tests and the Docker image build read the clone and push nothing with git. The two checkouts of Maintain Release Merge PR keep the token: that job resets the release branch and pushes it through create-pull-request. * ci: lock the workflow actions to the commits they resolve to GitHub's workflow dependency lockfile holds the commit each action reference resolves to, transitive actions included, and the runner uses those commits even if a tag moves later. .github/workflows/actions.lock comes from gh actions-lock (v0.4.1), which also narrowed every reference to the exact release it locked, so Dependabot keeps bumping versions and its security alerts keep matching. Re-run the same command after adding or bumping an action. * ci: drop the unused token scope from Notify HeyPuter, match workflow indentation * ci: remove the disabled release workflows release-please and Maintain Release Merge PR have been disabled since 2024; releases are cut from calver tags. Their entries leave the lockfile with them. --------- Co-authored-by: Daniel Salazar <daniel.salazar@puter.com>
106 lines
3.8 KiB
YAML
106 lines
3.8 KiB
YAML
name: Docker Image CI
|
|
|
|
# Two ways in:
|
|
# - push of a calver tag (YY.MM or YY.MM.p) → publishes <version>, latest, main
|
|
# - workflow_dispatch → publishes latest + main from whichever ref the user
|
|
# picks in the Actions UI. Used to fast-forward :latest/:main when the
|
|
# branch has moved ahead of the most recent release tag.
|
|
on:
|
|
push:
|
|
tags:
|
|
- '[0-9][0-9].[0-9][0-9]'
|
|
- '[0-9][0-9].[0-9][0-9].[0-9]*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
push_latest:
|
|
description: 'Push :latest tag'
|
|
type: boolean
|
|
default: true
|
|
push_main:
|
|
description: 'Push :main tag'
|
|
type: boolean
|
|
default: true
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
jobs:
|
|
build-and-push-image:
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Validate calver tag
|
|
if: github.event_name == 'push'
|
|
env:
|
|
REF_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
if ! [[ "$REF_NAME" =~ ^[0-9]{2}\.[0-9]{2}(\.[0-9]+)?$ ]]; then
|
|
echo "Tag '$REF_NAME' does not match YY.MM or YY.MM.p calver format."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Log in to GitHub Package Container registry
|
|
uses: docker/login-action@v4.8.0
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v4.8.0
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4.4.0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4.4.1
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v6.2.0
|
|
with:
|
|
images: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
heyputer/puter
|
|
# type=ref,event=tag only emits on tag pushes, so manual runs skip
|
|
# the calver tag and just publish whichever of latest / main the
|
|
# dispatch inputs asked for. On a tag push, both default to true.
|
|
tags: |
|
|
type=ref,event=tag
|
|
type=raw,value=latest,enable=${{ github.event_name == 'push' || inputs.push_latest }}
|
|
type=raw,value=main,enable=${{ github.event_name == 'push' || inputs.push_main }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v7.4.0
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
context: .
|
|
push: true
|
|
provenance: mode=max
|
|
sbom: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Sync README to Docker Hub
|
|
uses: peter-evans/dockerhub-description@v5.0.0
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
repository: heyputer/puter
|
|
readme-filepath: ./README.md
|