mirror of
https://github.com/CloakHQ/CloakBrowser.git
synced 2026-06-23 11:41:46 +02:00
c1b93e634b
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.9.1 to 4.1.1. - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](https://github.com/sigstore/cosign-installer/compare/398d4b0eeef1380460a10c8013a76f728fb906ac...cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003) --- updated-dependencies: - dependency-name: sigstore/cosign-installer dependency-version: 4.1.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
137 lines
5.3 KiB
YAML
137 lines
5.3 KiB
YAML
name: Publish
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
job:
|
|
description: 'Job to run (leave empty to run all)'
|
|
required: false
|
|
type: choice
|
|
options:
|
|
- ''
|
|
- publish-pypi
|
|
- publish-npm
|
|
- publish-docker
|
|
|
|
concurrency:
|
|
group: publish
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Python tests
|
|
run: |
|
|
pip install -e ".[dev]" pytest pytest-asyncio
|
|
pytest tests/ -v -m "not slow"
|
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: 22
|
|
- name: JavaScript tests
|
|
run: cd js && npm ci && npm run build && npm test
|
|
|
|
validate-version:
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Check tag matches package versions
|
|
run: |
|
|
TAG="${GITHUB_REF_NAME#v}"
|
|
PY=$(python -c 'import re; print(re.search(r"__version__\s*=\s*[\"'\'']([^\"'\'']+)", open("cloakbrowser/_version.py").read()).group(1))')
|
|
JS=$(python -c 'import json; print(json.load(open("js/package.json"))["version"])')
|
|
echo "Tag: $TAG | Python: $PY | npm: $JS"
|
|
[ "$TAG" = "$PY" ] || { echo "ERROR: tag v$TAG != _version.py $PY"; exit 1; }
|
|
[ "$TAG" = "$JS" ] || { echo "ERROR: tag v$TAG != package.json $JS"; exit 1; }
|
|
|
|
publish-pypi:
|
|
needs: [test, validate-version]
|
|
if: always() && needs.test.result == 'success' && (needs.validate-version.result == 'success' || needs.validate-version.result == 'skipped')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write # OIDC trusted publishing — no PYPI_TOKEN needed
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
with:
|
|
python-version: "3.12"
|
|
- name: Build
|
|
run: |
|
|
pip install build
|
|
python -m build
|
|
- name: Publish to PyPI
|
|
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1
|
|
|
|
publish-npm:
|
|
needs: [test, validate-version]
|
|
if: always() && needs.test.result == 'success' && (needs.validate-version.result == 'success' || needs.validate-version.result == 'skipped')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write # OIDC trusted publishing + provenance — no NPM_TOKEN needed
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
with:
|
|
node-version: 22
|
|
registry-url: 'https://registry.npmjs.org'
|
|
- name: Upgrade npm
|
|
run: npm install -g npm@latest
|
|
- name: Build
|
|
run: cd js && npm ci && npm run build
|
|
- name: Publish to npm
|
|
run: cd js && npm publish --provenance --access public
|
|
|
|
publish-docker:
|
|
needs: [test, validate-version]
|
|
if: always() && needs.test.result == 'success' && (needs.validate-version.result == 'success' || needs.validate-version.result == 'skipped')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write # Cosign keyless signing + attestations
|
|
contents: read
|
|
attestations: write
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
- name: Extract version
|
|
run: |
|
|
VERSION=$(python -c 'import re; print(re.search(r"__version__\s*=\s*[\"'\'']([^\"'\'']+)", open("cloakbrowser/_version.py").read()).group(1))')
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
|
|
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
|
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PAT }}
|
|
- name: Build and push
|
|
id: build
|
|
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
cloakhq/cloakbrowser:${{ env.VERSION }}
|
|
cloakhq/cloakbrowser:latest
|
|
provenance: true
|
|
sbom: true
|
|
- uses: sigstore/cosign-installer@cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003 # v4.1.1
|
|
- name: Sign image
|
|
run: cosign sign --yes cloakhq/cloakbrowser@${{ steps.build.outputs.digest }}
|
|
- name: Attest build provenance
|
|
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
|
|
with:
|
|
subject-name: index.docker.io/cloakhq/cloakbrowser
|
|
subject-digest: ${{ steps.build.outputs.digest }}
|
|
push-to-registry: true
|