Configure GoatCounter #67
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: deploy | |
on: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
# Allows JWT to be requested from GitHub's OIDC provider. | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- id: cache | |
uses: actions/cache@v4 | |
with: | |
# Use contents of Mamba environment file, NPM lock file and Poetry lock file as cache key. | |
key: ${{ hashFiles('environment.yml', 'package-lock.json', 'poetry.lock') }} | |
# Cache micromamba binary, environments and pipx installs. | |
path: | | |
~/.local/bin | |
~/micromamba | |
~/.local/pipx | |
# Install binaries, Mamba environment and Python dependencies if there is NOT a cache hit. | |
- if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
# Install latest micromamba (https://github.com/mamba-org/micromamba-releases/releases). | |
VERSION=2.0.2-2 INIT_YES=nope CONDA_FORGE_YES=nah "${SHELL}" <(curl -L micro.mamba.pm/install.sh) | |
# Install Poetry. | |
pipx install poetry~=1.8 | |
# Create Mamba environment from file. | |
export MAMBA_ROOT_PREFIX=~/micromamba | |
eval "$(micromamba shell hook -s posix)" | |
micromamba create --file environment.yml --yes | |
micromamba activate "${PWD##*/}" # If dir name == environment name... | |
# Install Python package dependencies. | |
poetry install | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::961672313229:role/Account-GithubOidcRole20798CD3-LZP3AHTIPJU2 | |
aws-region: ap-southeast-2 | |
- run: | | |
export MAMBA_ROOT_PREFIX=~/micromamba | |
eval "$(micromamba shell hook --shell posix)" | |
micromamba activate "${PWD##*/}" | |
# Set timezone so that Sphinx uses local dates. | |
sudo timedatectl set-timezone Australia/Queensland | |
# Build Sphinx website. | |
sphinx-build --builder html brodie.id.au _build | |
# Install Node.js package dependencies. | |
npm ci | |
# Show CDK stack diff. | |
npx cdk diff | |
# Deploy CDK stack. | |
npx cdk deploy --require-approval never |