From cc855c52749ae43b095a065228ad8dd4e53e1656 Mon Sep 17 00:00:00 2001 From: Bryce Dorn Date: Sat, 18 Feb 2023 21:33:33 +0000 Subject: [PATCH] add workflows --- .github/workflows/batch-process.yml | 32 ++++++++++++++++++++ .github/workflows/deploy-api.yml | 17 +++++++++++ .github/workflows/deploy-web.yml | 45 +++++++++++++++++++++++++++++ .github/workflows/hide-apod.yml | 35 ++++++++++++++++++++++ .github/workflows/process.yml | 39 +++++++++++++++++++++++++ 5 files changed, 168 insertions(+) create mode 100644 .github/workflows/batch-process.yml create mode 100644 .github/workflows/deploy-api.yml create mode 100644 .github/workflows/deploy-web.yml create mode 100644 .github/workflows/hide-apod.yml create mode 100644 .github/workflows/process.yml diff --git a/.github/workflows/batch-process.yml b/.github/workflows/batch-process.yml new file mode 100644 index 0000000..81bf377 --- /dev/null +++ b/.github/workflows/batch-process.yml @@ -0,0 +1,32 @@ +name: Batch process year +on: + workflow_dispatch: + inputs: + year: + description: 'Year' + required: true +env: + GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} +jobs: + batch-process-year: + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v3 + + - name: Install Rust ๐Ÿฆ€ + uses: dtolnay/rust-toolchain@v1 + with: + components: rustfmt, clippy + toolchain: stable + + - name: Lint ๐Ÿงน + run: | + cargo fmt --all -- --check + cargo clippy -- -D warnings + + - name: Test ๐Ÿ”จ + run: cargo test + + - name: Run ๐Ÿค– + run: cargo run -- batch ${{ github.event.inputs.year }} diff --git a/.github/workflows/deploy-api.yml b/.github/workflows/deploy-api.yml new file mode 100644 index 0000000..9a400ef --- /dev/null +++ b/.github/workflows/deploy-api.yml @@ -0,0 +1,17 @@ +name: Fly Deploy +on: + push: + branches: + - main +env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} +jobs: + deploy: + name: Deploy app + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: | + cd cache + flyctl deploy --remote-only \ No newline at end of file diff --git a/.github/workflows/deploy-web.yml b/.github/workflows/deploy-web.yml new file mode 100644 index 0000000..5c1377b --- /dev/null +++ b/.github/workflows/deploy-web.yml @@ -0,0 +1,45 @@ +name: Deploy site +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v3 + + - name: Install โš™๏ธ + run: | + cd web + npm install + + - name: Build ๐Ÿ›  + run: | + cd web + npm run build + + - name: Upload Artifacts ๐Ÿ”บ + uses: actions/upload-artifact@v1 + with: + name: site + path: web/dist + + deploy: + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v3 + + - name: Download Artifacts ๐Ÿ”ป + uses: actions/download-artifact@v1 + with: + name: site + + - name: Deploy ๐Ÿš€ + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: deploy + folder: "site" \ No newline at end of file diff --git a/.github/workflows/hide-apod.yml b/.github/workflows/hide-apod.yml new file mode 100644 index 0000000..18080e5 --- /dev/null +++ b/.github/workflows/hide-apod.yml @@ -0,0 +1,35 @@ +name: Hide days from results +on: + workflow_dispatch: + inputs: + date: + description: 'Dates (comma-separated YYYY-MM-DD)' + required: true +env: + SUPABASE_REST_URL: ${{ secrets.SUPABASE_REST_URL }} + SUPABASE_URL: ${{ secrets.SUPABASE_URL }} + SUPABASE_PUBLIC_API_KEY: ${{ secrets.SUPABASE_PUBLIC_API_KEY }} + GH_AUTH_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} +jobs: + hide-from-results: + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v3 + + - name: Install Rust ๐Ÿฆ€ + uses: dtolnay/rust-toolchain@v1 + with: + components: rustfmt, clippy + toolchain: stable + + - name: Lint ๐Ÿงน + run: | + cargo fmt --all -- --check + cargo clippy -- -D warnings + + - name: Test ๐Ÿ”จ + run: cargo test + + - name: Run ๐Ÿค– + run: cargo run -- exclude ${{ github.event.inputs.date }} diff --git a/.github/workflows/process.yml b/.github/workflows/process.yml new file mode 100644 index 0000000..afa29f5 --- /dev/null +++ b/.github/workflows/process.yml @@ -0,0 +1,39 @@ +name: Process images for month +on: + workflow_dispatch: + inputs: + year: + description: 'Year' + required: true + month: + description: 'Month' + required: true +env: + SUPABASE_REST_URL: ${{ secrets.SUPABASE_REST_URL }} + SUPABASE_URL: ${{ secrets.SUPABASE_URL }} + SUPABASE_PUBLIC_API_KEY: ${{ secrets.SUPABASE_PUBLIC_API_KEY }} + APOD_API_URL: ${{ secrets.APOD_API_URL }} + APOD_API_KEY: ${{ secrets.APOD_API_KEY }} +jobs: + process-images-for-month: + runs-on: ubuntu-latest + steps: + - name: Checkout ๐Ÿ›Ž๏ธ + uses: actions/checkout@v3 + + - name: Install Rust ๐Ÿฆ€ + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + toolchain: stable + + - name: Lint ๐Ÿงน + run: | + cargo fmt --all -- --check + cargo clippy -- -D warnings + + - name: Test ๐Ÿ”จ + run: cargo test + + - name: Run ๐Ÿค– + run: cargo run -- ${{ github.event.inputs.year }} ${{ github.event.inputs.month }}