Skip to content

Commit

Permalink
refactor: extract deno and python setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesdring committed Jan 22, 2025
1 parent 8b5d9d3 commit c718b61
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 49 deletions.
15 changes: 15 additions & 0 deletions .github/actions/setup-deno-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Setup deno environment
runs:
using: composite
steps:
- name: Setup deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Cache Deno dependencies
id: cache-deno
uses: actions/cache@v4
with:
key: deno-cache-${{ hashFiles('./deno.lock') }}
path: ${{ env.DENO_DIR }}
15 changes: 15 additions & 0 deletions .github/actions/setup-python-environment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Setup python environment
runs:
using: composite
steps:
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pipenv

- name: Setup pipenv
run: |
pip install pipenv
pipenv install
21 changes: 2 additions & 19 deletions .github/workflows/build-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,10 @@ jobs:
fetch-depth: 0

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pipenv

- name: Setup pipenv
run: |
pip install pipenv
pipenv install
uses: ./.github/actions/setup-python-environment

- name: Setup deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Cache Deno dependencies
id: cache-deno
uses: actions/cache@v4
with:
key: deno-cache-${{ hashFiles('./deno.lock') }}
path: ${{ env.DENO_DIR }}
uses: ./.github/actions/setup-deno-environment

- name: Get current data
run: |
Expand Down
25 changes: 4 additions & 21 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,10 @@ jobs:
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pipenv

- name: Setup pipenv
run: |
pip install pipenv
pipenv install
uses: ./.github/actions/setup-python-environment

- name: Setup deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Cache Deno dependencies
id: cache-deno
uses: actions/cache@v4
with:
key: deno-cache-${{ hashFiles('./deno.lock') }}
path: ${{ env.DENO_DIR }}
uses: ./.github/actions/setup-deno-environment

- name: Get current data
run: |
Expand All @@ -73,12 +56,12 @@ jobs:
echo "${{ secrets.DEPLOY_KEY }}" > deploy-key
ssh-add deploy-key
pipenv run dvc update data/published.dvc data/metadata.dvc
pipenv run dvc pull data/published.dvc data/metadata.dvc
ssh-add -D
echo "${{ secrets.DEPLOY_KEY_HUQ }}" > deploy-key-huq
ssh-add deploy-key-huq
pipenv run dvc update data/huq.dvc
pipenv run dvc pull data/huq.dvc
ssh-add -D
- name: Run pipelines
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/update-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pipenv

- name: Setup pipenv
run: |
pip install pipenv
pipenv install
uses: ./.github/actions/setup-python-environment

- name: Update data
run: |
Expand Down

0 comments on commit c718b61

Please sign in to comment.