Fetch CloudFormation resource specification and update this VSCode extension. #255
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Fetch CloudFormation resource specification and update this VSCode extension. | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "10 11 * * 5" # At 11:10 on Friday. | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Install Python | |
run: | | |
set -x -e | |
sudo apt install python3-setuptools | |
python3 -m pip install --upgrade pip && pip3 install -r src/requirements.txt | |
- name: Check if AWS updated the CloudFormation resource specification | |
id: check_spec | |
run: | | |
echo "Check if the cfn resource spec has been updated" | |
python3 src/check-cfn-resource-spec-hash.py || echo "::set-output name=spec_updated::false" | |
continue-on-error: true | |
- name: Stop if no changes | |
if: steps.check_spec.outputs.spec_updated == 'false' | |
run: | | |
echo "No updates to the CloudFormation resource spec. Exiting workflow." | |
exit 0 | |
- name: Update the yaml cfn resource type snippets | |
run: | | |
echo "Update the yaml cfn resource type snippets" | |
python3 src/update-cfn-resource-snippets.py --format yaml | |
- name: Update the json cfn resource type snippets | |
run: | | |
echo "Update the json cfn resource type snippets" | |
python3 src/update-cfn-resource-snippets.py --format json | |
- name: Update the json cfn resource type snippets | |
run: | | |
echo "Generate raw cfn resources output for link feature" | |
python3 src/create-raw-cfn-resources-output.py | |
- name: Commit changes to Github | |
run: | | |
set -x -e | |
# Configure git | |
git config --global user.name 'Github Actions' | |
git config --global user.email '[email protected]' | |
# Update version | |
npm version minor --force --no-git-tag-version | |
package_version=$(cat package.json | grep 'version":' | sed 's/[",]//g' | awk '{print $2}') | |
cfn_release_rss_summary=$(python3 src/update-and-parse-feed.py) | |
# Install dependencies and prepare for publishing | |
npm install | |
npm run vscode:prepublish | |
# Generate changelog | |
gitchangelog | tee "CHANGELOG.md" | |
# Commit and push changes | |
git commit -am "build: auto-update snippets to version: $package_version" | |
git push | |
# Create and push tag | |
git tag $package_version | |
git push origin --tags | |
- name: Publish to Visual Studio Marketplace | |
uses: HaaLeo/publish-vscode-extension@v1 | |
id: publishToVSCE | |
with: | |
pat: ${{ secrets.VSCE_TOKEN }} | |
registryUrl: https://marketplace.visualstudio.com | |
- name: Publish to Open VSX Registry | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: ${{ secrets.OPEN_VSX_TOKEN }} | |
extensionFile: ${{ steps.publishToVSCE.outputs.vsixPath }} |