Prep changelog for 2.2.0 release #14
Workflow file for this run
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: package release | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v[0-9]+.[0-9]+*' # Push events to matching v*, i.e. 1.0, 20.15.10 | |
jobs: | |
# Split release/upload workflow adapted from: | |
# https://github.com/actions/create-release/issues/14#issuecomment-555379810 | |
release: | |
name: Create and upload release | |
runs-on: ubuntu-latest | |
environment: releases | |
steps: | |
- name: Set output variables | |
id: vars | |
run: | | |
# strip the leading 'refs/tags/v' (start on 12th char) | |
VERSION=$(echo ${{ github.ref }} | cut -c12-) | |
echo ::set-output name=version::$VERSION | |
echo ::set-output name=release_date::$(date +'%Y-%m-%d') | |
echo ::set-output name=asset_name::aws-web-stacks-cf-templates-$VERSION | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# Don't use 'version' variable because we want the leading 'v' here. | |
# The actions/create-release@v1 action seems to remove the leading | |
# refs/tags/ on our behalf. | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} (${{ steps.vars.outputs.release_date}}) | |
draft: false | |
prerelease: false | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install requirements | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install awscli | |
- name: Build CloudFormation templates | |
run: make VERSION=${{ steps.vars.outputs.version }} versioned_templates | |
- name: Upload CloudFormation templates to S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: us-east-1 | |
run: make upload | |
- name: Zip CloudFormation templates | |
run: | | |
cp -r content/${{ steps.vars.outputs.version }}/ ${{ steps.vars.outputs.asset_name }}/ | |
zip -r ${{ steps.vars.outputs.asset_name }}.zip ${{ steps.vars.outputs.asset_name }}/ | |
- name: Upload CloudFormation templates to GitHub release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.vars.outputs.asset_name }}.zip | |
asset_name: ${{ steps.vars.outputs.asset_name }}.zip | |
asset_content_type: application/zip |