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
18 changes: 18 additions & 0 deletions common/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@craft-actions/common",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"test": "vitest run"
},
"exports": {
"./craft-builder.ts": "./src/craft-builder.ts",
"./pack-action.ts": "./src/pack-action.ts",
"./tools.ts": "./src/tools.ts"
},
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"test": "tests"
},
"scripts": {
"build": "pnpm node build.js src/rockcraft-pack.ts dist/rockcraft-pack/index.js",
"test": "vitest run",
"build": "pnpm -r --if-present run build",
"test": "pnpm -r run test",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"lint": "eslint .; ESLINT=$?; tsc --noEmit; TSC=$?; exit $((ESLINT | TSC))",
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
packages:
- "common"
- "rockcraft/pack"

allowBuilds:
esbuild: true
41 changes: 39 additions & 2 deletions rockcraft-pack/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file exists as a compatibility shim since this repository was not being versioned to allow breakages.

name: 'Build a rock'
description: 'Pack an OCI image with Rockcraft'
author: 'Canonical'
Expand Down Expand Up @@ -50,9 +52,44 @@ inputs:
outputs:
rock:
description: 'The file name of the resulting rock.'
value: ${{ steps.pack.outputs.rock }}
runs:
using: 'node24'
main: '../dist/rockcraft-pack/index.js'
using: 'composite'
steps:
- name: Deprecation notice
shell: bash
run: |
echo "::warning::rockcraft-pack is deprecated and will be removed in a future release. Please migrate to rockcraft/pack instead."
# This action is necessary as a workaround for https://github.com/actions/runner/issues/895.
# Since contexts cannot be used in the `uses:` key, we can't guarantee that this action will
# use the same branch of craft-actions to call other craft-actions workflows without just
# making our own local copy of the repository. See https://github.com/canonical/craft-actions/pull/45#discussion_r2586507869
# for a full explanation.
Comment thread
bepri marked this conversation as resolved.
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
env:
GITHUB_REF: ${{ github.action_ref }}
with:
repository: 'canonical/craft-actions'
ref: ${{ env.GITHUB_REF }}
path: _tmp_craft-actions
sparse-checkout: |
rockcraft/

- uses: ./_tmp_craft-actions/rockcraft/pack
id: pack
with:
path: ${{ inputs.path }}
verbosity: ${{ inputs.verbosity }}
rockcraft-channel: ${{ inputs.rockcraft-channel }}
revision: ${{ inputs.revision }}
test: ${{ inputs.test }}
pro: ${{ inputs.pro }}
ignore: ${{ inputs.ignore }}

- shell: bash
if: always()
run: |
rm -rf ./_tmp_craft-actions
branding:
icon: layers
color: orange
58 changes: 58 additions & 0 deletions rockcraft/pack/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: 'Build a rock'
description: 'Pack an OCI image with Rockcraft'
author: 'Canonical'
inputs:
path:
description: >
The location of the Rockcraft project.

Defaults to the base of the repository.
default: '.'
verbosity:
description: >
Set the build verbosity level to 'quiet', 'brief', 'verbose', 'debug' or
'trace'.

The default is 'trace'.
default: 'trace'
rockcraft-channel:
description: >
Install the snap from a specific channel

If not provided, it defaults to stable.
default: 'stable'
revision:
description: >
Pin the snap revision to install.

If not provided, it defaults to whatever revision is in latest/stable.
default: ''
test:
description: >
Run rockcraft test when packing the rock.

If not provided, it defaults to false.
default: 'false'
pro:
description: >
The Ubuntu Pro services to enable when packing the rock.

If not provided, no Ubuntu Pro services will be enabled.
default: ''
ignore:
description: >
Bypass a restriction to use an unsupported feature.

For example, 'unmaintained' will ignore that the base is unmaintained.

If not provided, it defaults to empty.
default: ''
outputs:
rock:
description: 'The file name of the resulting rock.'
runs:
using: 'node24'
main: 'dist/index.js'
branding:
icon: layers
color: orange
Loading
Loading