Skip to content
This repository was archived by the owner on May 29, 2024. It is now read-only.

Commit bda01e1

Browse files
authored
Move to Github Actions (#18)
* Move to Github actions * Release
1 parent 8024826 commit bda01e1

File tree

4 files changed

+88
-44
lines changed

4 files changed

+88
-44
lines changed

.github/workflows/publish.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
3+
name: Publish Version
4+
on:
5+
release:
6+
types: [created, edited]
7+
jobs:
8+
publish:
9+
name: Publish Version
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Fetch Tags
14+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
15+
- name: Configure AWS credentials
16+
uses: aws-actions/configure-aws-credentials@v1
17+
with:
18+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
19+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
20+
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
21+
aws-region: ${{ secrets.REGION }}
22+
- name: Set version
23+
id: version
24+
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
25+
# Cache
26+
- uses: actions/cache@v1
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-
32+
# Setup
33+
- name: Set up Python 3.7
34+
uses: actions/setup-python@v1
35+
with:
36+
python-version: 3.7
37+
- name: Install python dependencies
38+
run: pip3 install -r requirements.txt
39+
# Package and Upload Archive
40+
- name: Package
41+
run: zip -r "$VERSION.zip" -@ < ci/include.lst
42+
- name: Upload artefact
43+
run: aws s3 cp ./$VERSION.zip s3://$CFN_BUCKET/aws-waf-classic-workshop/$VERSION/aws-waf-classic-workshop.zip > /dev/null 2>&1
44+
env:
45+
CFN_BUCKET: ${{ secrets.CFN_BUCKET }}

.github/workflows/release.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
3+
name: Release Version
4+
on:
5+
push:
6+
branches:
7+
- master
8+
jobs:
9+
release:
10+
name: Release Version
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
15+
# Setup
16+
- name: Set up Python 3.7
17+
uses: actions/setup-python@v1
18+
with:
19+
python-version: 3.7
20+
- name: Install python dependencies
21+
run: pip3 install -r requirements.txt
22+
# Release if required
23+
- name: Set version
24+
id: version
25+
run: |
26+
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
27+
echo "THIS_VERSION=$(cat templates/main.template | shyaml get-value Metadata.Version)" >> $GITHUB_ENV
28+
echo "THIS_VERSION_COMPARABLE=$(version $(cat templates/main.template | shyaml get-value Metadata.Version))" >> $GITHUB_ENV
29+
echo "LATEST_VERSION_COMPARABLE=$(version $(git describe --tags $(git rev-list --tags --max-count=1) | sed s/^v// 2> /dev/null || echo '0'))" >> $GITHUB_ENV
30+
- name: Create Release
31+
id: create_release
32+
uses: actions/create-release@latest
33+
if: env.THIS_VERSION_COMPARABLE > env.LATEST_VERSION_COMPARABLE
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
36+
with:
37+
tag_name: v${{ env.THIS_VERSION }}
38+
release_name: Release v${{ env.THIS_VERSION }}
39+
body: |
40+
See the commits for a list of features included in this release
41+
draft: false
42+
prerelease: false

.travis.yml

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

templates/main.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
AWSTemplateFormatVersion: '2010-09-09'
22
Description: Workshop about AWS WAF and WAF Security Automations Solution (uksb-1q1gt3g5d)
33
Metadata:
4-
Version: '2.2'
4+
Version: '2.3'
55
AWS::CloudFormation::Interface:
66
ParameterGroups:
77
- Label:

0 commit comments

Comments
 (0)