GitHub 操作 - AWS CLI
GitHub Action - AWS CLI
最近以下GitHubAction has been deprecated with a deletion date already established at end of month (2019-12-31). The issue is, there is no "official" alternative yet (should be here)。我的问题是:
有人知道“正式”动作是否会在 2019-12-31 之前发布吗?
还有其他选择吗?
从 GitHub documentation 开始,aws-cli
已经可以直接在主机映像上使用。
如果在弃用通知中提供此信息就好了
¯\_(ツ)_/¯
repo 昨天更新了以下新的弃用通知:
This action has been deprecated in favor of
https://github.com/aws-actions. This repo has been archived and will
be made private on 12/31/2019
aws-cli 包在 GitHub 托管的虚拟环境中可用。 (aws-cli/1.16.266 Python/2.7.12 Linux/4.15.0-1057-azure botocore/1.13.2)
确保在环境变量中设置 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY。您可以使用 Github secrets 安全地存储这些凭据。
- name: Upload to S3
run: |
aws s3 sync ./build s3://test-bucket
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'ap-south-1'
默认 awscli
或使用第三方操作的替代方法是配置 python 并在构建时安装 awscli
:
name: Sync to S3 bucket
on: [push]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install awscli
- run: aws s3 sync builddir s3://foobar --region eu-west-1 --cache-control max-age=0 --acl public-read --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
"Github 操作 > 构建和测试 Python" Github https://docs.github.com/en/actions/guides/building-and-testing-python
上的文档
AWS CLI 将预装在 GitHub Actions 环境中。可以在 actions/virtual-environments repository. In my case I needed the latest possible version of the CLI. I followed the AWS CLI Install documentation 中找到更多信息,并将以下步骤添加到 ubuntu/latest
上的工作流程 运行:
- name: Install AWS CLI v2
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip
unzip -q /tmp/awscliv2.zip -d /tmp
rm /tmp/awscliv2.zip
sudo /tmp/aws/install --update
rm -rf /tmp/aws/
最近以下GitHubAction has been deprecated with a deletion date already established at end of month (2019-12-31). The issue is, there is no "official" alternative yet (should be here)。我的问题是:
有人知道“正式”动作是否会在 2019-12-31 之前发布吗?
还有其他选择吗?
从 GitHub documentation 开始,aws-cli
已经可以直接在主机映像上使用。
如果在弃用通知中提供此信息就好了
¯\_(ツ)_/¯
repo 昨天更新了以下新的弃用通知:
This action has been deprecated in favor of https://github.com/aws-actions. This repo has been archived and will be made private on 12/31/2019
aws-cli 包在 GitHub 托管的虚拟环境中可用。 (aws-cli/1.16.266 Python/2.7.12 Linux/4.15.0-1057-azure botocore/1.13.2)
确保在环境变量中设置 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY。您可以使用 Github secrets 安全地存储这些凭据。
- name: Upload to S3
run: |
aws s3 sync ./build s3://test-bucket
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'ap-south-1'
默认 awscli
或使用第三方操作的替代方法是配置 python 并在构建时安装 awscli
:
name: Sync to S3 bucket
on: [push]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install awscli
- run: aws s3 sync builddir s3://foobar --region eu-west-1 --cache-control max-age=0 --acl public-read --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
"Github 操作 > 构建和测试 Python" Github https://docs.github.com/en/actions/guides/building-and-testing-python
上的文档AWS CLI 将预装在 GitHub Actions 环境中。可以在 actions/virtual-environments repository. In my case I needed the latest possible version of the CLI. I followed the AWS CLI Install documentation 中找到更多信息,并将以下步骤添加到 ubuntu/latest
上的工作流程 运行:
- name: Install AWS CLI v2
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip
unzip -q /tmp/awscliv2.zip -d /tmp
rm /tmp/awscliv2.zip
sudo /tmp/aws/install --update
rm -rf /tmp/aws/