-
Notifications
You must be signed in to change notification settings - Fork 142
61 lines (60 loc) · 2.44 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
name: Release Version
on:
push:
branches:
- master
jobs:
release:
name: Release Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
# Set AWS Credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
aws-region: ${{ secrets.REGION }}
# Setup
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install virtualenv
run: pip install virtualenv
- name: Install dependencies
run: make setup-predeploy
# Release if required
- name: Setup versions in env variables
id: version
run: |
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
echo "THIS_VERSION=$(make version | sed s/^v//)" >> $GITHUB_ENV
echo "THIS_VERSION_COMPARABLE=$(version $(make version | sed s/^v//))" >> $GITHUB_ENV
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
- name: Create Release
id: create_release
uses: actions/create-release@latest
if: env.THIS_VERSION_COMPARABLE > env.LATEST_VERSION_COMPARABLE
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: v${{ env.THIS_VERSION }}
release_name: Release v${{ env.THIS_VERSION }}
body: |
See the CHANGELOG for a list of features included in this release
draft: false
prerelease: true
# Package and Upload Archive
- name: Pre-Package Copy Function
run: cd source/witch/ && npm install --prefix nodejs mime-types && cp witch.js nodejs/node_modules/ && zip -r ../../witch.zip nodejs && cd ../../
- name: Package Release
run: zip -r packaged.zip -@ < ci/include.lst
- name: Upload Release
run: aws s3 cp packaged.zip s3://$CFN_BUCKET/amazon-cloudfront-secure-static-site/v${{ env.THIS_VERSION }}/amazon-cloudfront-secure-static-site.zip
env:
CFN_BUCKET: ${{ secrets.CFN_BUCKET }}