The action uploads files from the given folder to Yandex Cloud Object Storage using Service Account Key as authorizations method.
Table of Contents
- name: Upload files to Object Storage
id: s3-upload
uses: yc-actions/yc-obj-storage-upload@v3
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
bucket: ${{ secrets.BUCKET }}
root: ./src
include: |
*.js
package.json
exclude: |
**/*.ts
One of yc-sa-json-credentials
, yc-iam-token
or yc-sa-id
should be provided depending on the authentication method you
want to use. The action will use the first one it finds.
yc-sa-json-credentials
should contain JSON with authorized key for Service Account. More info in Yandex Cloud IAM documentation.yc-iam-token
should contain IAM token. It can be obtained usingyc iam create-token
command or using yc-actions/yc-iam-token-fed
- name: Get Yandex Cloud IAM token
id: get-iam-token
uses: docker://ghcr.io/yc-actions/yc-iam-token-fed:1.0.0
with:
yc-sa-id: aje***
yc-sa-id
should contain Service Account ID. It can be obtained usingyc iam service-accounts list
command. It is used to exchange GitHub token for IAM token using Workload Identity Federation. More info in Yandex Cloud IAM documentation.
You can also use clear: true
option to clear bucket before uploading files.
- name: Upload files to Object Storage
id: s3-upload
uses: yc-actions/yc-obj-storage-upload@v3
with:
yc-sa-id: ${{ secrets.YC_SA_ID }}
bucket: ${{ secrets.BUCKET }}
root: ./src
include: |
*.js
package.json
exclude: |
**/*.ts
clear: true
If you want to configure Cache-Control
header for uploaded files, you can use cache-control
option.
Value of *
key will be used as default value for all files. You can also specify cache control for file paths.
- name: Upload files to Object Storage
id: s3-upload
uses: yc-actions/yc-obj-storage-upload@v3
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
bucket: ${{ secrets.BUCKET }}
root: ./src
include: |
*.js
package.json
exclude: |
**/*.ts
cache-control: |
*.js, *.css: public, max-age=31536000, immutable
*.png, *.jpg, *.jpeg, *.gif, *.svg, *.ico: public, max-age=31536000
*.html: max-age=3600
*: no-cache
See action.yml for the full documentation for this action's inputs and outputs.
To perform this action, it is required that the service account on behalf of which we are acting has granted the
storage.uploader
role or greater.
If you want to clear bucket before uploading files using clear: true
option, the service account should have
storage.editor
role or greater.
This code is made available under the MIT license.