forked from TeamKugimiya/ModsTranslationPack
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (82 loc) · 2.62 KB
/
CI-OverrideCache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: CI | Override Cache
on:
push:
branches:
- "main"
paths:
- ".github/configs/override_list.json"
pull_request:
branches:
- "main"
paths:
- ".github/configs/override_list.json"
workflow_dispatch:
inputs:
cache_url_test:
description: "Test Cache URL"
required: false
type: boolean
permissions:
contents: read
jobs:
Cache-Override:
name: Cache Override
runs-on: ubuntu-latest
if: |
github.repository == 'TeamKugimiya/ModsTranslationPack'
steps:
- name: Checking Repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install poetry
uses: abatilo/actions-poetry@v3
- name: Setup a local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Cache Python
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install project dependencies
run: poetry install
- name: Make cache folder
run: mkdir cache
- name: Testing URL
if: ${{ inputs.cache_url_test }}
run: |
poetry run python ../.github/scripts/override_script.py Test
working-directory: cache
- name: Make Cache
if: ${{ ! inputs.cache_url_test }}
run: |
poetry run python ../.github/scripts/override_script.py
ls -lh MultiVersions/
working-directory: cache
- name: Compress Cache
if: ${{ ! inputs.cache_url_test && github.event_name != 'pull_request' }}
run: |
zip -qr Override-Cache.zip MultiVersions/
rm -r MultiVersions/
sha256sum Override-Cache.zip > checksum.txt
working-directory: cache
- name: Testing Cache
if: ${{ ! inputs.cache_url_test && github.event_name != 'pull_request' }}
run: |
unzip -t Override-Cache.zip
working-directory: cache
- name: Upload cache to s3
if: ${{ ! inputs.cache_url_test && github.event_name != 'pull_request' }}
uses: Docker-Collection/docker-aws-s3-action@main
with:
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_s3_endpoint: ${{ secrets.AWS_S3_ENDPOINT }}
source_dir: "cache"
dest_dir: "cache/"
aws_command: "sync"