Skip to content

Commit dad69e9

Browse files
committed
add id-token test
1 parent 003f41e commit dad69e9

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

.github/workflows/layer.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,32 @@ on:
55
tags:
66
- 'v*.*.*'
77

8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
813
jobs:
9-
export_layer:
14+
export-layer:
1015
uses: oomol/ovmlayer-rootfs/.github/workflows/export-package-layer.yml@main
1116
secrets:
12-
token: ${{ secrets.GITHUB_TOKEN }}
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
post-layer:
19+
runs-on: ubuntu-latest
20+
needs: export-layer
21+
steps:
22+
- name: Install OIDC Client from Core Package
23+
run: npm install @actions/[email protected] @actions/http-client
24+
shell: bash
25+
- name: Get Id Token
26+
uses: actions/github-script@v7
27+
id: id_token
28+
with:
29+
script: |
30+
const coredemo = require('@actions/core')
31+
let id_token = await coredemo.getIDToken()
32+
coredemo.setOutput('id_token', id_token)
33+
- name: post
34+
run: |
35+
echo "Layer exported successfully."
36+
curl -X POST -H "Content-Type: application/json" -H "Authorization: github-action-${{ steps.id_token.outputs.id_token }}" -d '{"amd64": "https://static.oomol.com/layers/amd64-layer.zip", "arm64": "https://static.oomol.com/layers/arm64-layer.zip"}' registry.oomol.dev/-/oomol/packages/layer-example/0.0.1/file-paths

package.oo.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ scripts:
55
bootstrap: |
66
npm install
77
poetry install --no-root
8+
name: layer-example
9+
repository: https://github.com/oomol/ovmlayer-rootfs
10+
displayName: layer-example
11+
description: layer-example

0 commit comments

Comments
 (0)