Skip to content

Commit f206d44

Browse files
committed
change to use rst to auto-generate toc
1 parent c31ba1c commit f206d44

File tree

2 files changed

+98
-80
lines changed

2 files changed

+98
-80
lines changed

README.md

Lines changed: 0 additions & 80 deletions
This file was deleted.

README.rst

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
alibabacloud-oidc-auth
2+
-----------------------
3+
4+
GitHub Action for authenticating to Alibaba Cloud with `GitHub Actions OIDC tokens`_.
5+
6+
.. contents::
7+
8+
9+
Inputs
10+
======
11+
12+
* ``role-arn-to-assume``: (Required) The arn of Ram role.
13+
* ``oidc-provider-arn``: (Required) The arn of OIDC IdP.
14+
* ``export-environment-variables``: (Optional) Export common environment variables. The default value is: ``false``
15+
* ``set-outputs``: (Optional) Setting action outputs. The default value is: ``false``
16+
* ``audience``: (Optional) The audience (aud) parameter in GitHub's generated OIDC
17+
token. The default value is: ``actions.github.com``
18+
* ``role-duration-seconds``: (Optional) The validity period of the STS token. The default value is: ``3600``
19+
* ``role-session-name``: (Optional) The custom name of the role session. The default value is: ``github-actions-<orgName>-<repoName>``
20+
* ``region``: (Optional) The region id of STS endpoint. The default value is: ``ap-southeast-1``
21+
22+
Outputs
23+
========
24+
25+
Only available when ``set-outputs`` is ``true``.
26+
27+
* ``access-key-id``: (Optional) The AccessKey ID.
28+
* ``access-key-secret``: (Optional) The AccessKey secret.
29+
* ``security-token``: (Optional) The STS token.
30+
31+
32+
Example Usage
33+
==============
34+
35+
.. code-block:: yaml
36+
37+
jobs:
38+
job-id:
39+
# ...
40+
permissions:
41+
id-token: write # This is required for requesting the JWT
42+
steps:
43+
- name: get credentials
44+
id: get-credentials
45+
uses: 'mozillazg/alibabacloud-oidc-auth@v1'
46+
with:
47+
role-arn-to-assume: '${{ secrets.ALIBABA_CLOUD_RAM_ROLE_ARN }}'
48+
oidc-provider-arn: '${{ secrets.ALIBABA_CLOUD_RAM_OIDC_ARN }}'
49+
export-environment-variables: 'true'
50+
- run: |
51+
aliyun sts GetCallerIdentity
52+
53+
54+
Or
55+
56+
.. code-block:: yaml
57+
58+
jobs:
59+
job-id:
60+
# ...
61+
permissions:
62+
id-token: write # This is required for requesting the JWT
63+
steps:
64+
- name: get credentials
65+
id: get-credentials
66+
uses: 'mozillazg/alibabacloud-oidc-auth@v1'
67+
with:
68+
role-arn-to-assume: '${{ secrets.ALIBABA_CLOUD_RAM_ROLE_ARN }}'
69+
oidc-provider-arn: '${{ secrets.ALIBABA_CLOUD_RAM_OIDC_ARN }}'
70+
set-outputs: 'true'
71+
- run: |
72+
ossutil64 --access-key-id ${{ steps.get-credentials.outputs.access-key-id }} \
73+
--access-key-secret ${{ steps.get-credentials.outputs.access-key-secret }} \
74+
--sts-token ${{ steps.get-credentials.outputs.security-token }} --mode StsToken \
75+
--endpoint oss-ap-southeast-1.aliyuncs.com \
76+
stat oss://test-bucket
77+
78+
79+
RAM Configuration
80+
==================
81+
82+
1. Configure an `OIDC IdP`_ for the auth method:
83+
* **IdP URL**: ``https://token.actions.githubusercontent.com``
84+
* **Client ID**: ``actions.github.com``
85+
86+
2. Configure a `RAM role for an OIDC IdP`_ to assume:
87+
* **oidc:aud**: ``actions.github.com``
88+
* **oidc:sub**: match on `GitHub subject claims`_.
89+
90+
* match branch: ``repo:<orgName/repoName>:ref:refs/heads/<branchName>``
91+
* match tag: ``repo:<orgName/repoName>:ref:refs/tags/<tagName>``
92+
93+
94+
.. _GitHub Actions OIDC tokens : https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect
95+
.. _OIDC IdP: https://www.alibabacloud.com/help/en/resource-access-management/latest/manage-an-oidc-idp?spm=a2c63.p38356.0.0.3d076b9do9jEJr#section-hqp-6mi-g84
96+
.. _RAM role for an OIDC IdP: https://www.alibabacloud.com/help/en/resource-access-management/latest/create-a-ram-role-for-a-trusted-idp#section-mra-74d-14w
97+
.. _GitHub subject claims: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#example-subject-claims
98+

0 commit comments

Comments
 (0)