Skip to content

Commit

Permalink
Use a Scheduled Github Action for freshening data (#60)
Browse files Browse the repository at this point in the history
* Add first draft of data fetching script

* add triggers

* typo fix

* run on pull request

* exit on error

* install deps

* install erlang-dev as a dependency.

* fix syntax error

* remove unnecessary compile step

* yes and

* add ssh debugging thingy

* run ssh session in the background

* attempt to limit memory. Let's see what happens.

* chatgpt take the wheel lmao

* ok not that much

* install rebar from repos instead of attempting to compile locally

* use setup-beam action

* specify versions

* jk not gleam

* step it back a bit

* fix ssl_verify_fun issue

* precompile deps

* include smash.gg token in env

* remove tmate thingy

* remove pull_request trigger

* more cleanup
  • Loading branch information
perrycate authored Jul 3, 2023
1 parent 51e896b commit b694855
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/refresh-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Freshen Data
run-name: Freshen Data
on:
workflow_dispatch:
schedule:
- cron: '*/30 * * * *'
jobs:
freshen-tournament-data:
runs-on: ubuntu-latest
# Apparently this was supposed to be something more reasonable like "production" or "staging".
# I had no idea what I was doing and don't see a way to change this in GitHub (this is what
# associates the env vars and stuff) and am too lazy to remake it.
environment: Default I guess
env:
SMASH_GG_TOKEN: ${{ secrets.SMASH_GG_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
steps:
- name: Install BEAM stuff
uses: erlef/setup-beam@v1.16.0
with:
otp-version: '25'
elixir-version: '1.14'

- name: Check out repository code
uses: actions/checkout@v3

- name: Install Dependencies
run: |
mix deps.get
mix deps.compile
- name: Run data freshening script
run: deploy/freshen_data.sh
3 changes: 3 additions & 0 deletions deploy/freshen_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# You must have elixir, mix, aws cli, etc. on your system, and the S3 bucket
# should be one you control.

# Exit if anything returns a non-zero status.
set -e

# There's an assumption here that update_tourneys is actually writing a
# file named exactly tournaments.json. Really we should just be passing in
# a file name or something, or better yet just writing it to stdout or something.
Expand Down
4 changes: 3 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ defmodule Tournamap.MixProject do
[
{:httpoison, "~> 1.8"},
{:json, "~> 1.4"},
{:phoenix_html, github: "phoenixframework/phoenix_html"}
{:phoenix_html, github: "phoenixframework/phoenix_html"},
# See https://github.com/deadtrickster/ssl_verify_fun.erl/issues/29
{:ssl_verify_fun, "~>1.1.0", [env: :prod, hex: "ssl_verify_fun", repo: "hexpm", optional: false, manager: :rebar3, override: :true]}
]
end
end

0 comments on commit b694855

Please sign in to comment.