Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/raw_artifact_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish RAW artifact to e2e
on:
workflow_call:
inputs:
platform-url:
type: string
default: ''
description: Platform URL; defaults to caller vars.E2E_PLATFORM_URL
package-url:
type: string
required: true
sha256:
type: string
required: true
source-commit:
type: string
required: true
description: Actual commit used to build this package
source-ref:
type: string
default: ''
filename:
type: string
default: ''
expected-version:
type: string
default: ''
runs-on:
type: string
default: '["ubuntu-latest"]'
description: JSON runner labels; caller provides network reachability
secrets:
E2E_RAW_PUBLISH_TOKEN:
required: true
outputs:
task-id:
value: ${{ jobs.publish.outputs.task-id }}
artifact-id:
value: ${{ jobs.publish.outputs.artifact-id }}
artifact-url:
value: ${{ jobs.publish.outputs.artifact-url }}
permissions:
contents: read
jobs:
publish:
runs-on: ${{ fromJSON(inputs.runs-on) }}
timeout-minutes: 35
outputs:
task-id: ${{ steps.publish.outputs.task-id }}
artifact-id: ${{ steps.publish.outputs.artifact-id }}
artifact-url: ${{ steps.publish.outputs.artifact-url }}
steps:
- name: Import and verify RAW package
id: publish
uses: IceWhaleTech/github/actions/publish-raw@raw-publish-v1.0.0
with:
platform-url: ${{ inputs.platform-url || vars.E2E_PLATFORM_URL }}
publish-token: ${{ secrets.E2E_RAW_PUBLISH_TOKEN }}
package-url: ${{ inputs.package-url }}
sha256: ${{ inputs.sha256 }}
source-commit: ${{ inputs.source-commit }}
source-ref: ${{ inputs.source-ref }}
filename: ${{ inputs.filename }}
expected-version: ${{ inputs.expected-version }}
35 changes: 35 additions & 0 deletions .github/workflows/raw_publish_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: RAW publisher checks
on:
pull_request:
paths:
- actions/publish-raw/**
- tests/test_raw_publish.py
- .github/workflows/raw_artifact_publish.yml
- .github/workflows/raw_publish_test.yml
push:
branches: [main]
paths:
- actions/publish-raw/**
- tests/test_raw_publish.py
- .github/workflows/raw_artifact_publish.yml
- .github/workflows/raw_publish_test.yml
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Test publisher without credentials or external services
run: python3 -m unittest discover -s tests -p 'test_raw_publish.py' -v
- uses: actions/setup-go@v6
with:
go-version: '1.25'
cache: false
- name: Validate publisher workflows
run: |
go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.12
"$(go env GOPATH)/bin/actionlint" -shellcheck= -pyflakes= .github/workflows/raw_artifact_publish.yml .github/workflows/raw_publish_test.yml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__/
*.pyc
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,79 @@ existing `API_TOKEN_GITHUB` secret:

Callers should pin these workflows to a release tag such as
`@openapi-sdk-v1.0.2` (or a full commit SHA), rather than `@main`.

## Publish RAW application packages to e2e

Use the immutable `raw-publish-v1.0.0` tag (or full commit SHA). The publisher
imports and verifies a package; device installation is a separate platform action.

Create a repository-scoped credential in **Application artifacts → CI publishing**.
Set Actions Variable `E2E_PLATFORM_URL` and Secret `E2E_RAW_PUBLISH_TOKEN` in the
calling repository, or authorize it to use organization values. The caller owns
network reachability. The runner needs Python 3; local builds also use Git to
record the actual checkout commit.

Add this step at the end of the job that builds the RAW file:

```yaml
- name: Publish RAW to e2e
id: e2e
uses: IceWhaleTech/github/actions/publish-raw@raw-publish-v1.0.0
with:
platform-url: ${{ vars.E2E_PLATFORM_URL }}
publish-token: ${{ secrets.E2E_RAW_PUBLISH_TOKEN }}
package-path: dist/folio.raw
# source-commit: actual 40-character build commit (defaults to checkout HEAD)
# source-ref: refs/tags/v1.2.3 (defaults to github.ref)
# expected-version: 1.2.3 (optional exact package version assertion)
```

No Actions artifact upload is needed. Alternatively, publish an existing HTTP(S)
download URL with the URL-only reusable workflow:

```yaml
jobs:
publish-e2e:
needs: build
permissions:
contents: read
uses: IceWhaleTech/github/.github/workflows/raw_artifact_publish.yml@raw-publish-v1.0.0
with:
package-url: ${{ needs.build.outputs.raw-url }}
sha256: ${{ needs.build.outputs.raw-sha256 }}
source-commit: ${{ needs.build.outputs.source-commit }}
source-ref: ${{ needs.build.outputs.source-ref }}
filename: folio.raw
# platform-url defaults to caller vars.E2E_PLATFORM_URL
# runs-on: '["self-hosted", "Linux", "X64", "my-network"]'
secrets:
E2E_RAW_PUBLISH_TOKEN: ${{ secrets.E2E_RAW_PUBLISH_TOKEN }}
```

`build` is caller-defined and must output the actual source commit/ref and package
checksum. The platform must be able to download the URL; private GitHub web URLs
are not direct download links. Signed URLs must last through ingestion. An import
source does not become a managed replica and is not deleted when the platform
artifact is deleted.

The Action accepts exactly one of `package-path` / `package-url`. URL mode requires
`sha256`; local files are streamed and hashed automatically. `filename` preserves
the original download name. The package manifest is authoritative for its version;
git tags are recorded separately. The Action returns `task-id`, `sha256`, verified
`artifact-id` and `artifact-url`, and writes a step summary. The reusable workflow
returns task and artifact outputs. Import failures and timeouts fail the job;
timeouts leave the platform task running and preserve its ID. Default wait is
1800 seconds (`wait-timeout` input).

Same repository/run/attempt/SHA/filename reuses the original task. Changed build
metadata under that identity is rejected. Distinct attempts retain provenance
while deduplicating bytes. Failed imports require a new GitHub run attempt, rather
than silently creating another task. Credentials cannot delete packages, access
settings, or deploy to devices. Rotate the Secret before revoking the old token.

Use credentials only in trusted branches/tags or protected manual jobs. Do not
expose them to untrusted PRs/forks or execute their code using `pull_request_target`.
Local mock-HTTP tests run without credentials or external services. The package's
Action and reusable workflow share the same immutable `raw-publish-v*` release tag;
merge and pass checks before tagging, and never move existing tags. Real service
integration requires caller configuration after isolated acceptance.
67 changes: 67 additions & 0 deletions actions/publish-raw/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Publish RAW to e2e
description: Import a verified RAW application package and preserve its GitHub build provenance
inputs:
platform-url:
description: e2e platform base URL; normally vars.E2E_PLATFORM_URL
required: true
publish-token:
description: Repository-scoped RAW publisher secret
required: true
package-path:
description: Local RAW path; mutually exclusive with package-url
default: ''
package-url:
description: Download URL; mutually exclusive with package-path
default: ''
sha256:
description: Required for URL publication; local files are hashed automatically
default: ''
filename:
description: Original RAW filename; defaults to path or URL basename
default: ''
expected-version:
description: Optional exact package version assertion; git refs are recorded separately
default: ''
source-commit:
description: Actual built commit; local file defaults to checked-out HEAD
default: ''
source-ref:
description: Full built ref; defaults to github.ref
default: ''
wait-timeout:
description: Seconds to wait for verified import
default: '1800'
poll-interval:
description: Seconds between task status requests
default: '5'
outputs:
task-id:
description: Platform import task ID
value: ${{ steps.publish.outputs.task-id }}
artifact-id:
description: Verified immutable artifact SHA-256
value: ${{ steps.publish.outputs.artifact-id }}
artifact-url:
description: Platform artifact details URL
value: ${{ steps.publish.outputs.artifact-url }}
sha256:
description: Requested package SHA-256
value: ${{ steps.publish.outputs.sha256 }}
runs:
using: composite
steps:
- id: publish
shell: bash
env:
INPUT_PLATFORM_URL: ${{ inputs.platform-url }}
INPUT_PUBLISH_TOKEN: ${{ inputs.publish-token }}
INPUT_PACKAGE_PATH: ${{ inputs.package-path }}
INPUT_PACKAGE_URL: ${{ inputs.package-url }}
INPUT_SHA256: ${{ inputs.sha256 }}
INPUT_FILENAME: ${{ inputs.filename }}
INPUT_EXPECTED_VERSION: ${{ inputs.expected-version }}
INPUT_SOURCE_COMMIT: ${{ inputs.source-commit }}
INPUT_SOURCE_REF: ${{ inputs.source-ref }}
INPUT_WAIT_TIMEOUT: ${{ inputs.wait-timeout }}
INPUT_POLL_INTERVAL: ${{ inputs.poll-interval }}
run: python3 "$GITHUB_ACTION_PATH/publish.py"
Loading