-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
86 additions
and
86 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ on: | |
push: | ||
branches: [ main ] | ||
|
||
# TODO: REMOVE THIS AGAIN | ||
pull_request: | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
|
@@ -34,7 +38,9 @@ jobs: | |
id: cached-discord-app-poetry | ||
uses: actions/cache@v2 | ||
with: | ||
path: discord_app/.venv | ||
path: | | ||
discord_app/.venv | ||
discord_app/.serverless/cache | ||
key: venv-${{ runner.os }}-${{ hashFiles('discord_app/poetry.lock') }} | ||
|
||
- name: Poetry install for discord_app/ | ||
|
@@ -102,7 +108,7 @@ jobs: | |
name: infra | ||
path: infra/ | ||
|
||
release: | ||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -123,19 +129,92 @@ jobs: | |
with: | ||
name: error-parser-package | ||
|
||
- name: Install Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached venv for infra | ||
id: cached-infra-poetry | ||
uses: actions/cache@v2 | ||
with: | ||
path: infra/.venv | ||
key: venv-${{ runner.os }}-${{ hashFiles('infra/poetry.lock') }} | ||
|
||
- name: Poetry install for infra/ | ||
run: cd infra && poetry install | ||
if: steps.cached-infra-poetry.outputs.cache-hit != 'true' | ||
|
||
- name: Synthesize CDK | ||
run: cd infra && poetry run npx cdk synth --output build/cdk.out | ||
env: | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_TARGET_ACCOUNT: ${{ secrets.AWS_TARGET_ACCOUNT }} | ||
DISCORD_PUBLIC_KEY: ${{ secrets.DISCORD_PUBLIC_KEY }} | ||
DISCORD_APPLICATION_ID: ${{ secrets.DISCORD_APPLICATION_ID }} | ||
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} | ||
NOTIFICATION_EMAIL: ${{ secrets.NOTIFICATION_EMAIL }} | ||
|
||
- name: Deploy CDK | ||
run: cd infra && npx cdk synth --app ./build/cdk.out --require-approval never | ||
env: | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_TARGET_ACCOUNT: ${{ secrets.AWS_TARGET_ACCOUNT }} | ||
|
||
release: | ||
needs: build # TODO: do after 'deploy' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install poetry | ||
uses: snok/[email protected] | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Build Changelog | ||
id: changes | ||
run: echo "::set-output name=changeLog::$(git show --format=%B | tail +3)" | ||
run: echo "::set-output name=changelog::$(git log --format=%B -1 | tail +3)" | ||
|
||
- name: Get the base version | ||
id: release_version | ||
run: echo "::set-output name=version::$(cd discord_app && poetry version -s)" | ||
|
||
- name: Get the date of the release | ||
id: release_date | ||
run: echo "::set-output name=date::$(date +"%Y-%m-%d")" | ||
|
||
- name: Get the shorthash of the commit | ||
id: release_hash | ||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
|
||
- name: Check changelog | ||
run: echo ${{ steps.changes.outputs.changelog }} | ||
|
||
- name: Check release name | ||
run: echo "v${{ steps.release_version.outputs.version }}.${{ steps.release_date.outputs.date }}.${{ steps.release_hash.outputs.sha_short }}" | ||
|
||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: ${{ steps.release_name.outputs.date }} ${GITHUB_SHA::7} | ||
release_name: ${{ steps.release_name.outputs.date }} ${GITHUB_SHA::7} | ||
body: ${{steps.changes.outputs.changelog}} | ||
tag_name: "v${{ steps.release_version.outputs.version }}.${{ steps.release_date.outputs.date }}.${{ steps.release_hash.outputs.sha_short }}" | ||
release_name: "v${{ steps.release_version.outputs.version }}.${{ steps.release_date.outputs.date }}.${{ steps.release_hash.outputs.sha_short }}" | ||
body: ${{ steps.changes.outputs.changelog }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "discord_app" | ||
version = "0.8.0" | ||
version = "1.0" | ||
description = "" | ||
authors = ["lesteenman <[email protected]>"] | ||
|
||
|