-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (86 loc) · 2.87 KB
/
Copy pathoidc-github-e2e.yml
File metadata and controls
98 lines (86 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: GitHub OIDC E2E
run-name: Trusted publishing E2E ${{ inputs.test_id }}
on:
workflow_dispatch:
inputs:
cli_sha:
description: Exact candidate CLI commit
required: true
type: string
server_url:
description: Isolated loopback URL allocated by op-build
required: true
type: string
server_version:
description: Expected candidate server version
required: true
type: string
audience:
description: Unique audience provisioned by op-build
required: true
type: string
package_name:
description: Disposable package provisioned by op-build
required: true
type: string
runner_label:
description: Unique label of the self-hosted build-machine runner
required: true
type: string
test_id:
description: Build correlation ID
required: true
type: string
permissions:
contents: read
id-token: write
concurrency:
group: trusted-publishing-${{ inputs.runner_label }}
cancel-in-progress: false
jobs:
publish:
name: Publish using a real GitHub identity
runs-on: [self-hosted, linux, '${{ inputs.runner_label }}']
timeout-minutes: 15
environment: oidc-e2e
env:
ONEPUB_E2E_URL: ${{ inputs.server_url }}
ONEPUB_E2E_VERSION: ${{ inputs.server_version }}
ONEPUB_E2E_AUDIENCE: ${{ inputs.audience }}
ONEPUB_E2E_PACKAGE: ${{ inputs.package_name }}
steps:
- name: Configure isolated CLI storage
shell: bash
run: |
fixture_root="$RUNNER_TEMP/onepub-e2e-$GITHUB_RUN_ID"
{
echo "ONEPUB_PATH=$fixture_root/settings"
echo "XDG_CONFIG_HOME=$fixture_root/config"
echo "_PUB_TEST_CONFIG_DIR=$fixture_root/config/dart"
echo "PUB_CACHE=$fixture_root/pub-cache"
} >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
ref: ${{ inputs.cli_sha }}
persist-credentials: false
- name: Verify the candidate checkout
env:
EXPECTED_SHA: ${{ inputs.cli_sha }}
run: test "$(git rev-parse HEAD)" = "$EXPECTED_SHA"
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
# setup-dart exports its default cache, overriding our isolated path.
- name: Restore isolated package cache
shell: bash
run: echo "PUB_CACHE=$RUNNER_TEMP/onepub-e2e-$GITHUB_RUN_ID/pub-cache" >> "$GITHUB_ENV"
- name: Install CLI dependencies
run: dart pub get --enforce-lockfile
- name: Publish with the GitHub trusted identity
run: dart run tool/trusted_publishing_e2e.dart
- name: Remove temporary credentials and cache
if: always()
shell: bash
env:
CLEANUP_PATH: ${{ runner.temp }}/onepub-e2e-${{ github.run_id }}
run: rm -rf -- "$CLEANUP_PATH"